11.12.2017, 12:17
Hello guys, i have a war system on my server and when i am not in a turf and i use /attack (to attack even i'm not in a turf) i get SERVER: Unknown command and in server_log this error:
On my database I have a table with all the turfs starting from 1 to 36 (inclusive 36).
Variables:
Line problem:
Код:
[15:11:29] [debug] Run time error 4: "Array index out of bounds" [15:11:29] [debug] AMX backtrace: [15:11:29] [debug] #0 0016b1b8 in public IsPlayerInTurf (playerid=0, turfid=37) at D:\gamemode\gamemodes\exgaming.pwn:22304 [15:11:29] [debug] #1 001af6f4 in public cmd_attack (playerid=0, params[]=@01560ffc "") at D:\gamemode\gamemodes\exgaming.pwn:26674 [15:11:29] [debug] #2 native CallLocalFunction () from samp03svr [15:11:29] [debug] #3 0003c25c in public OnPlayerCommandText (playerid=0, cmdtext[]=@01560fdc "/attack") at D:\gamemode\pawno\include\zcmd.inc:102
Variables:
Код:
new TurfInfo[37][zInfo], Turfs[37];
Код:
public IsPlayerInTurf(playerid, turfid) { if(IsPlayerConnected(playerid)) { if(turfid == -1) { return 0; } new Float:x, Float:y, Float:z; GetPlayerPos(playerid,x,y,z); if(x >= TurfInfo[turfid][zMinX] && x < TurfInfo[turfid][zMaxX] && y >= TurfInfo[turfid][zMinY] && y < TurfInfo[turfid][zMaxY]) //line 26674 { return 1; } } return 0; }