14.12.2016, 16:57
I usually have alot of problems with this kind, i thought lets ask help to solve one of them and ill the rest my self.
This is the code to check, if player is capturing zone, while doing that the zone owner comes into zone, the capturing status fails and zone gets locked...
This that is under onplayerenter area, and i am getting this in debug when player enters a area:
Additional information:
Line given in warnings:
PHP код:
if(Player[playerid][PlayerGang] != -1 && !IsPlayerNPC(playerid))
{
new zone = Gang[Player[playerid][PlayerGang]][CurrentZone];
if(GangZone[zone][ZoneStatus] == true && GangZone[zone][ZoneOwner] == Player[playerid][PlayerGang])
{
new msg1[128];
format(msg1, sizeof(msg1), "{FF0000}** %s gang failed to capture %s zone, REASON: Oppenent Gang reached to rescue!", Gang[Player[playerid][PlayerGang]][GangName], GangZone[zone][ZoneName]);
SendClientMessageToAll(-1, msg1);
Gang[Player[playerid][PlayerGang]][CurrentZone] = -1;
GangZone[zone][ZoneLocked] = GetTickCount();
GangZone[zone][ZoneStatus] = false;
GangZoneStopFlashForAll(GangZone[zone][ZoneHolder]);
}
}
This that is under onplayerenter area, and i am getting this in debug when player enters a area:
PHP код:
[debug] Run time error 4: "Array index out of bounds"
[debug] Accessing element at negative index -1
[debug] AMX backtrace:
[debug] #0 00055d98 in public S@@_OnPlayerEnterArea (playerid=1, areaid=27) at C:\Users\iLearner\Desktop\ffss\pawno\include\FFS/FFS_gangs.inc:1250
[debug] #1 0000cb00 in Area_AddCuboid (... <2 variable arguments>) at C:\Users\iLearner\Desktop\ffss\pawno\include\YSI\y_hooks/impl.inc:2502
[debug] #2 native CallRemoteFunction () [00471b40] from samp-server.exe
[debug] #3 00024c9c in Area_DoEnter (playerid=1, areaid=27, &idx=@0x020f41d0) at C:\Users\iLearner\Desktop\ffss\pawno\include\YSI\y_areas.inc:2770
[debug] #4 00020c6c in bool:Area_AddCuboid (... <1 variable argument>) at C:\Users\iLearner\Desktop\ffss\pawno\include\YSI\y_areas.inc:2110
[debug] #5 0000b954 in Area_AddCuboid (... <1 variable argument>) at C:\Users\iLearner\Desktop\ffss\pawno\include\YSI\y_hooks/impl.inc:1997
Line given in warnings:
PHP код:
if(GangZone[zone][ZoneStatus] == true && GangZone[zone][ZoneOwner] == Player[playerid][PlayerGang])