21.08.2017, 17:03
Код:
Line 14966: [11:32:43] [debug] Run time error 4: "Array index out of bounds" Line 14967: [11:32:43] [debug] Attempted to read/write array element at negative index -1 Line 14968: [11:32:43] [debug] AMX backtrace: Line 14969: [11:32:43] [debug] #0 00284bd4 in ?? (... <2 arguments>) at C:\Users\Martin Ivanov\Desktop\server working\server working\gamemodes\bgmod.pwn:23193 Line 14970: [11:32:43] [debug] #1 00018b88 in public OnPlayerCommandText (playerid=36, cmdtext[]=@0184a468 "/sethp michel123 100") at C:\Users\Martin Ivanov\Desktop\server working\server working\pawno\include\YSI\y_hooks/impl.inc:929
Код:
if(strcmp(cmd, "/sethp", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "Използвай: /sethp [Playerid/PartOfName] [health]"); return 1; } new playa; new health; playa = ReturnUser(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "Използвай: /sethp [Playerid/PartOfName] [health]"); return 1; } health = strval(tmp); if(Dueling[playa] == true) return SendClientMessage(playerid,COLOR_RED,"Играчът е в дуел в момента!"); if (pInfo[playerid][Adminlevel] >= 2 && pInfo[playerid][Adminlevel] <=7) { if(IsPlayerConnected(playa)) { if(playa != INVALID_PLAYER_ID) { SetPlayerHealth(playa, health); format(string, sizeof(string), "ADMIN: Администратор %s зареди твоята кръв на %d", PlayerName(playerid), health); SendClientMessage(playa, COLOR_LIGHT_BLUE, string); } } } else { SendClientMessage(playerid, COLOR_RED, "Нямаш права, за да ползваш командата!"); } } return 1; }
Код:
SetPlayerHealth(playa, health);