Bug happens if player dies himself(falls down, for example) - 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: Bug happens if player dies himself(falls down, for example) (
/showthread.php?tid=358071)
Bug happens if player dies himself(falls down, for example) -
pasha97 - 09.07.2012
In server i have a random hunting system, sometimes server selects a random player as a hunting target, and first player who kills him gets score. And it works fine. But if player falls from sopmewhere, or kills himself, score goes to a player with id 0. I want to know, how can i fix it? is there any way?
Re: Bug happens if player dies himself(falls down, for example) -
Lordzy - 09.07.2012
Try updating sscanf or post your script lines.
Re: Bug happens if player dies himself(falls down, for example) -
JaKe Elite - 09.07.2012
Show you script code.
and Nice fake server banner you got their on your signature.
Attracting players.
Re: Bug happens if player dies himself(falls down, for example) -
pasha97 - 09.07.2012
Quote:
Originally Posted by Romel
Show you script code.
and Nice fake server banner you got their on your signature.
Attracting players.
|
lol yeah dude
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(playerid==huntid && killerid != playerid && huntstat==1)
{
format(stringu, sizeof(stringu), "{ffffff}%s {ffcc00}has won the hunting by killing {ffffff}%s {ffcc00}and got {00ff00}%d {ffcc00}score!",pname,name,huntscore);
SendClientMessageToAll(0x00FF00FF, stringu);
huntstat=0;
hunttimer1=SetTimer("Hunting",random(180000)+300000,0);
Delete3DTextLabel(huntlabel);
SetPlayerScore(killerid, GetPlayerScore(killerid) + huntscore);
KillTimer(hunttimer2);
}
}
Re: Bug happens if player dies himself(falls down, for example) -
clarencecuzz - 09.07.2012
Try adding
pawn Код:
&& killerid != INVALID_PLAYER_ID
to the:
pawn Код:
if(playerid==huntid && killerid != huntid && huntstat==1)
line.
Therefore giving you:
pawn Код:
if(playerid==huntid && killerid != huntid && killerid != INVALID_PLAYER_ID && huntstat==1)
EDIT: I am suggesting this, because I think that when a player dies from no reason, I do not think that the killerid is equal to the playerid, the killerid would be an INVALID_PLAYER_ID. Please reply if it was not successful.
Re: Bug happens if player dies himself(falls down, for example) -
reh_007 - 09.07.2012
@Clarence,
Did not know, can script,