14.04.2016, 06:12
Код:
[14/04/2016 10:08:15] [debug] Run time error 4: "Array index out of bounds" [14/04/2016 10:08:15] [debug] Accessing element at negative index -1 [14/04/2016 10:08:15] [debug] AMX backtrace: [14/04/2016 10:08:15] [debug] #0 0020ccb8 in public cmd_sungcuatoi (playerid=15, params[]=@07ed7e00 "") at C:\Users\Administrator\Desktop\mode\mode\mode\gamemodes\NGRP.pwn:40714 [14/04/2016 10:08:15] [debug] #1 native CallLocalFunction () from samp-server.exe [14/04/2016 10:08:15] [debug] #2 000075a4 in public OnPlayerCommandText (playerid=15, cmdtext[]=@07ed7dd0 "/sungcuatoi") at C:\Users\Administrator\Desktop\mode\mode\mode\pawno\include\ZCMD.inc:102
Код:
CMD:sungcuatoi(playerid, params[]) { new string[128], myweapons[13][2], weaponname[50], encryption[256], name[MAX_PLAYER_NAME]; if(GetPVarInt(playerid, "IsInArena") == -1) { GetPlayerName(playerid, name, sizeof(name)); SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________"); format(string, sizeof(string), "Vu khi cua %s:", name); SendClientMessageEx(playerid, COLOR_WHITE, string); for (new i = 0; i < 13; i++) { GetPlayerWeaponData(playerid, i, myweapons[i][0], myweapons[i][1]); if(myweapons[i][0] > 0) { if(PlayerInfo[playerid][pGuns][i] == myweapons[i][0]) { GetWeaponName(myweapons[i][0], weaponname, sizeof(weaponname)); format(string, sizeof(string), "%s (Wep ID: %d) - %d Vien dan", weaponname, myweapons[i][0], PlayerInfo[playerid][pAmmo][GetAmmoSlot(PlayerInfo[playerid][pGuns][i])]); SendClientMessageEx(playerid, COLOR_GRAD1, string); format(encryption, sizeof(encryption), "%s%d", encryption, myweapons[i][0]); } } } SendClientMessageEx(playerid, COLOR_GREEN, string); SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________"); } else { SendClientMessageEx(playerid, COLOR_YELLOW, "Ban dang o trong Arena khong the su dung cau lenh nay."); } return 1; }
Код:
format(string, sizeof(string), "%s (Wep ID: %d) - %d Vien dan", weaponname, myweapons[i][0], PlayerInfo[playerid][pAmmo][GetAmmoSlot(PlayerInfo[playerid][pGuns][i])]);