05.03.2015, 19:05
Hello, I've just been testing my commands to make sure all of them are working fine and are at their top, but as I was testing I was watching my command panel and the debug kept picking errors on death, I've through it and I have no idea what is wrong with it, I will show you itand see if you can spot what I have been doing wrong.
I have a problem when I die or when anyone dies, even if I use a command to kill them this error keeps happening,
I have been over this like 300 times and couldn't see what is wrong, here is everything to do with death,
OnPlayerSpawn
Like I said, i've been through this alot and couldn't find the error. It would be amazing if you are able to help me out here! this is being a real pain in the ass Thank you guys!
I have a problem when I die or when anyone dies, even if I use a command to kill them this error keeps happening,
Код:
[19:27:49] [debug] Run time error 4: "Array index out of bounds" [19:27:49] [debug] Accessing element at index 65535 past array upper bound 499 [19:27:49] [debug] AMX backtrace: [19:27:49] [debug] #0 0001f4e0 in ?? (0, 65535, 54) from Accounts1.0.amx [19:27:49] [debug] #1 0000551c in public OnPlayerDeath (0, 65535, 54) from Accounts1.0.amx
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
pInfo[killerid][Kills] += 1;
pInfo[playerid][Deaths] += 1;
SpecStats = 0;
pInfo[playerid][Wasted]++;
GiveXP(killerid, -100); //return SCM(playerid, pink, "You have lost 100 XP for killing a player!");
return 1;
}
pawn Код:
if(pInfo[playerid][Wasted] == 1)
{
SetPlayerPos(playerid, 1579.0249,1769.8119,10.8203); //
SetPlayerFacingAngle(playerid,201.1649);
pInfo[playerid][Wasted] = 0;
return 1;
}
pawn Код:
CMD:die(playerid, params[])
{
SetPlayerHealth(playerid, 0);
SCM(playerid, red, "You have committed suicide");
pInfo[playerid][Wasted]= 1;
getdate(lyear, lmonth, lday);
gettime(lhour, lminute, lsecond);
GetPlayerName(ID, pName, sizeof(pName));
format(lstr, sizeof lstr, "(COMMAND)(%02d/%02d/%04d %02d:%02d:%02d):%s(%d): has used /die\r\n", lyear, lmonth, lday, lhour, lminute, lsecond,pName, ID);
AllLogs(lstr);
return 1;
}
pawn Код:
ACMD:kill(playerid, params[])
{
if (pInfo[playerid][Adminlevel] < 1) return 0;
new reason[128];
if(sscanf(params, "us[50]", ID, reason)) return SCM(playerid, orange, "Kill a player: /kill <ID> <Reason>");
if(ID == IPI)return SCM(playerid, red, "*Player is not connected.");
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(ID, pName, sizeof(pName));
SetPlayerHealth(ID, 0);
format(ustr, sizeof(ustr), "%s %s has killed you for %d", AdminLevelName(playerid), pName, pName, reason);
SCM(ID, red, ustr);
format(ustr,sizeof(ustr),"*You have killed %s", pName);
SCM(playerid, Lblue, ustr);
return 1;
}