OnPlayerDeath shows something with crashdetect - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerDeath shows something with crashdetect (
/showthread.php?tid=378882)
OnPlayerDeath shows something with crashdetect -
MarkoN - 19.09.2012
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid == playerid)
{
pInfo[playerid][Deaths]++;
}
else if(killerid == INVALID_PLAYER_ID)
{
pInfo[playerid][Deaths]++;
}
else
GivePlayerMoney(killerid, 500);
SetPlayerScore(killerid, GetPlayerScore(killerid)+10);
SetPlayerScore(playerid, GetPlayerScore(playerid)-10);
SendDeathMessage(killerid, playerid, reason);
pInfo[killerid][Kills]++;
pInfo[playerid][Deaths]++;
return 1;
}
Код:
[19:33:48] [debug] Run time error 4: "Array index out of bounds"
[19:33:48] [debug] Accessing element at index 65535 past array upper bound 499
[19:33:48] [debug] AMX backtrace:
[19:33:48] [debug] #0 000212b8 in public OnPlayerDeath () from gangwars.amx
[19:33:48] [death] MarkoN died 255
Re: OnPlayerDeath shows something with crashdetect -
ViniBorn - 19.09.2012
This seems wrong
pawn Код:
if(killerid == playerid)
{
pInfo[playerid][Deaths]++;
}
else if(killerid == INVALID_PLAYER_ID)
{
pInfo[playerid][Deaths]++;
}
}
Re: OnPlayerDeath shows something with crashdetect - Glint - 19.09.2012
Sorry to ask but what does this do ?
pawn Код:
if(killerid == playerid)
{
pInfo[playerid][Deaths]++;
}
Re: OnPlayerDeath shows something with crashdetect -
MarkoN - 19.09.2012
Quote:
Originally Posted by [Lexi]
Sorry to ask but what does this do ?
pawn Код:
if(killerid == playerid) { pInfo[playerid][Deaths]++; }
|
Eh, that checks if a killer is the same person as the player who died, so it doesnt give the killer(player) +1 in kills
that couldove been done with killerid == INVALID_PLAYER_ID too
Re: OnPlayerDeath shows something with crashdetect -
Lordzy - 19.09.2012
Quote:
Originally Posted by [Lexi]
Sorry to ask but what does this do ?
pawn Код:
if(killerid == playerid) { pInfo[playerid][Deaths]++; }
|
The script code looks like that when a player kills, that player's death rate also increases.
OT:
pawn Код:
public OnPlayerSpawn(playerid)
{
GivePlayerMoney(playerid,-100);
return 1;
} //Try this.
Re: OnPlayerDeath shows something with crashdetect - Glint - 19.09.2012
Ok guys thanks i just wanted to know.
Re: OnPlayerDeath shows something with crashdetect -
SuperViper - 19.09.2012
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
if(killerid != INVALID_PLAYER_ID)
{
GivePlayerMoney(killerid, 500);
SetPlayerScore(killerid, GetPlayerScore(killerid)+10);
pInfo[killerid][Kills]++;
}
SetPlayerScore(playerid, GetPlayerScore(playerid)-10);
pInfo[playerid][Deaths]++;
return 1;
}