OPlayerDeath BUG - 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: OPlayerDeath BUG (
/showthread.php?tid=388160)
OPlayerDeath BUG -
Beljulji - 27.10.2012
i have some big bug a it happends to players constantly when player die he is still on foot and dont spawn on spawnplace
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
if(killerid != INVALID_PLAYER_ID)GivePlayerMoney(playerid,1000);
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
pInfo[killerid][Kills]++;
pInfo[playerid][Deaths]++;
return 1;
}
any help?
Re: OPlayerDeath BUG -
NewerthRoleplay - 27.10.2012
Here is a edited version, I'm not sure what the problem is but some of your script is wrong, firstly I am sure that when a player dies you do not want to give the player who is dead money so instead it is now the killerid and I made your if statement actually return some kind of value.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
if(killerid != INVALID_PLAYER_ID) return GivePlayerMoney(killer,1000);
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
pInfo[killerid][Kills]++;
pInfo[playerid][Deaths]++;
return 1;
}
Re: OPlayerDeath BUG -
Catalyst- - 27.10.2012
You're problem seems to be that you're using your "killerid" variables/functions while "killerid" equals INVALID_PLAYER_ID.
This is how it should be:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
if(killerid != INVALID_PLAYER_ID) {
GivePlayerMoney(killerid, 1000);
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
pInfo[killerid][Kills]++;
}
SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
pInfo[playerid][Deaths]++;
return 1;
}
Re: OPlayerDeath BUG -
Beljulji - 27.10.2012
i changed from killer to killerid cuz it shows me error
Re: OPlayerDeath BUG -
NewerthRoleplay - 28.10.2012
Quote:
Originally Posted by Beljulji
i changed from killer to killerid cuz it shows me error
|
Oh yea, sorry my bad wrote it from scratch when I was tired xD