DubininAlex
Новичок
Столкнулся с проблемой пропадания гангзон, в самом начале не было 2 квадратов возле базы VAGOS, далее при захватах территорий и рестарте начали потихоньку пропадать другие зоны, не знаю в чем проблема. Подскажите пожалуйста. Мод на MySQL, гангзоны загружаются в БД, таблица норм вроде, ошибок при загрузке нет в логах. Вот код ганг зон:
Еще
и
PHP:
stock GetGangZoneColor(gangzonex)
{
new zx;
switch(GZInfo[gangzonex][gFrak])
{
case 12: zx = 0x8823AAAA;
case 13: zx = 0xEBC34AA;
case 15: zx = 0x006600AA;
case 17: zx = 0x00EBFFAA;
case 18: zx = 0x4444AAAA;
default: zx = 0xFEFEFEAA;
}
return zx;
}
stock GetGZColorF(fnumber)
{
new zx;
switch(fnumber)
{
case 12: zx = 0x8823AAAA;
case 13: zx = 0xEBC34AA;
case 15: zx = 0x006600AA;
case 17: zx = 0x00EBFFAA;
case 18: zx = 0x4444AAAA;
default: zx = 0xFEFEFEAA;
}
return zx;
}
Еще
PHP:
publics: OnLoadGzCallback()
{
new time = GetTickCount();
new r, f;
cache_get_data(r, f);
new idx;
for(idx = 1; idx <= r; idx++)
{
GZInfo[idx][id] = cache_get_row_int(idx-1, 0, connects);
GZInfo[idx][gCoords][0] = cache_get_row_float(idx-1, 1, connects);
GZInfo[idx][gCoords][1] = cache_get_row_float(idx-1, 2, connects);
GZInfo[idx][gCoords][2] = cache_get_row_float(idx-1, 3, connects);
GZInfo[idx][gCoords][3] = cache_get_row_float(idx-1, 4, connects);
GZInfo[idx][gFrak] = cache_get_row_int(idx-1, 5, connects);
TOTALGZ++;
GZInfo[idx][id] = GangZoneCreate(GZInfo[idx][gCoords][0],GZInfo[idx][gCoords][1],GZInfo[idx][gCoords][2],GZInfo[idx][gCoords][3]);
ZoneOnBattle[idx] = 0;
GZSafeTime[idx] = 0;
}
printf("[Загрузка ганг зон]: Было загружено - %d потрачено %d (ms)", TOTALGZ, GetTickCount() - time);
return 1;
}
stock SaveGZ(idx)
{
new mysql_query_[512];
format(mysql_query_, sizeof(mysql_query_), "UPDATE "TABLE_GANGZONE" SET ginfo1 = '%f', ginfo2 = '%f', ginfo3 = '%f', ginfo4 = '%f', fraction = %i WHERE id = %i",
GZInfo[idx][gCoords][0], GZInfo[idx][gCoords][1],GZInfo[idx][gCoords][2],GZInfo[idx][gCoords][3],GZInfo[idx][gFrak], idx);
mysql_function_query(connects, mysql_query_, false, "", "");
return true;
}
PHP:
enum Ganginfa
{
capture,
score,
captureid,
gangnumber
}
new GangInfo[MAX_GANGS][Ganginfa];
#define MAX_GZONE 150
new ZoneOnBattle[MAX_GZONE];
new allowedfactions[] = {12,13,15,17,18};
new GZSafeTime[MAX_GZONE];
enum GzoneInfo
{
id,
Float:gCoords[4],
gFrak,
gNapad
}
new GZInfo[MAX_GZONE][GzoneInfo];
new TOTALGZ;
new Timer[10];
stock CaptureEnd(familyone, familytwo)
{
foreach (new i : Player)
{
if(!IsAGang(i)) continue;
if(PlayerInfo[i][pMember] == familyone || PlayerInfo[i][pMember] == familytwo)
{
PlayerTextDrawHide(i, BandaCapt1a[i]);
PlayerTextDrawHide(i, BandaCapt2a[i]);
PlayerTextDrawHide(i, ScoreCapt1a[i]);
PlayerTextDrawHide(i, ScoreCapt2a[i]);
PlayerTextDrawHide(i, ScoreCaptTire[i]);
PlayerTextDrawHide(i, CaptTime[i]);
PlayerTextDrawHide(i, ScoreCapt[i]);
PlayerTextDrawHide(i, Textdraw4[i]);
SetPVarInt(i,"GzOn",0);
}
}
}
stock CaptureUpd(bandkiller)
{
new SCORE1[128];
new SCORE2[128];
foreach (new i : Player)
{
if(!IsAGang(i)) continue;
if(GangInfo[PlayerInfo[i][pMember]][capture] > 0)
{
if(GangInfo[bandkiller][gangnumber] == 1)
{
format(SCORE1, 64, "%d", GangInfo[bandkiller][score]);
PlayerTextDrawSetString(i,ScoreCapt1a[i], SCORE1);
}
else
{
format(SCORE2, 64, "%d", GangInfo[bandkiller][score]);
PlayerTextDrawSetString(i,ScoreCapt2a[i], SCORE2);
}
}
}
}
stock GzCheck()
{
for(new i =1;i<=TOTALGZ;i++)
{
if(GZSafeTime[i] > 0)
{
GZSafeTime[i]--;
foreach (new x : Player)
{
if(PlayerInfo[x][pMember] == GZInfo[i][gNapad] || PlayerInfo[x][pMember] == GZInfo[i][gFrak])
{
if(GetPVarInt(x,"GzOn") == 0)
{
new BANDAA[128],BANDAB[128];
PlayerTextDrawShow(x, BandaCapt1a[x]);
PlayerTextDrawShow(x, BandaCapt2a[x]);
PlayerTextDrawShow(x, ScoreCapt1a[x]);
PlayerTextDrawShow(x, ScoreCapt2a[x]);
PlayerTextDrawShow(x, ScoreCaptTire[x]);
PlayerTextDrawShow(x, CaptTime[x]);
PlayerTextDrawShow(x, ScoreCapt[x]);
PlayerTextDrawShow(x, Textdraw4[x]);
format(BANDAA, 128, "~y~%s", GetGangName(GZInfo[i][gNapad]));
PlayerTextDrawSetString(x,BandaCapt1a[x], BANDAA);
format(BANDAB, 128, "~y~%s", GetGangName(GZInfo[i][gFrak]));
PlayerTextDrawSetString(x,BandaCapt2a[x], BANDAB);
format(BANDAA, 64, "~r~0");
PlayerTextDrawSetString(x,ScoreCapt1a[x], BANDAA);
format(BANDAB, 64, "~r~0");
PlayerTextDrawSetString(x,ScoreCapt2a[x], BANDAB);
SetPVarInt(x,"GzOn",1);
}
new stringText[30];
convert(GZSafeTime[i], stringText);
PlayerTextDrawSetString(x,CaptTime[x], stringText);
}
}
}
if(ZoneOnBattle[i] == 1 && GZSafeTime[i] == 0)
{
if(GangInfo[GZInfo[i][gNapad]][score] > GangInfo[GZInfo[i][gFrak]][score] ||
GangInfo[GZInfo[i][gNapad]][score] == 0 && GangInfo[GZInfo[i][gFrak]][score] == 0)
{
new zx,zl;
zx = GZInfo[i][gNapad];
zl = i;
format(stringer1,90,"[F] Банда %s выйгрывает захват зоны",GetGangName(zx));
SendFamilyMessage(GZInfo[i][gFrak],COLOR_LIGHTRED, stringer1);
SendFamilyMessage(GZInfo[i][gNapad],COLOR_LIGHTRED, stringer1);
ZoneOnBattle[zl] =0;
CaptureEnd(GZInfo[zl][gNapad], GZInfo[zl][gFrak]);
GangInfo[GZInfo[zl][gNapad]][captureid] = 0;
GangInfo[GZInfo[zl][gNapad]][capture] = 0;
GangInfo[GZInfo[zl][gNapad]][score] = 0;
GangInfo[GZInfo[zl][gFrak]][captureid] = 0;
GangInfo[GZInfo[zl][gFrak]][capture] = 0;
GangInfo[GZInfo[zl][gFrak]][score] = 0;
GangInfo[GZInfo[i][gNapad]][gangnumber] = 0;
GangInfo[GZInfo[i][gFrak]][gangnumber] = 0;
GZInfo[zl][gFrak] = zx;
GZInfo[zl][gNapad] = 0;
IsCapture = 0;
GangZoneStopFlashForAll(GZInfo[zl][id]);
GangZoneHideForAll(GZInfo[zl][id]);
GangZoneShowForAll(GZInfo[zl][id],GetGangZoneColor(zl));
SaveGZ(zl);
Timer[7] = 0;
}
else if(GangInfo[GZInfo[i][gNapad]][score] < GangInfo[GZInfo[i][gFrak]][score] ||
GangInfo[GZInfo[i][gNapad]][score] == GangInfo[GZInfo[i][gFrak]][score])
{
new zx,zl;
zx = GZInfo[i][gFrak];
zl = i;
format(stringer1,90,"[F] Банда %s выйгрывает захват зоны",GetGangName(zx));
SendFamilyMessage(GZInfo[i][gFrak],COLOR_LIGHTRED, stringer1);
format(stringer1,90,"[F] Банда %s выйграла, вы проиграли захват зоны",GetGangName(zx));
SendFamilyMessage(GZInfo[i][gNapad],COLOR_LIGHTRED, stringer1);
ZoneOnBattle[zl] =0;
CaptureEnd(GZInfo[zl][gNapad], GZInfo[zl][gFrak]);
GangInfo[GZInfo[zl][gNapad]][captureid] = 0;
GangInfo[GZInfo[zl][gNapad]][capture] = 0;
GangInfo[GZInfo[zl][gNapad]][score] = 0;
GangInfo[GZInfo[zl][gFrak]][captureid] = 0;
GangInfo[GZInfo[zl][gFrak]][capture] = 0;
GangInfo[GZInfo[zl][gFrak]][score] = 0;
GangInfo[GZInfo[i][gNapad]][gangnumber] = 0;
GangInfo[GZInfo[i][gFrak]][gangnumber] = 0;
IsCapture = 0;
GZInfo[zl][gFrak] = zx;
GZInfo[zl][gNapad] = 0;
GangZoneStopFlashForAll(GZInfo[zl][id]);
GangZoneHideForAll(GZInfo[zl][id]);
GangZoneShowForAll(GZInfo[zl][id],GetGangZoneColor(zl));
SaveGZ(zl);
Timer[7] = 0;
}
}
}
}
Последнее редактирование:
