Bug happens if player dies himself(falls down, for example)
#1

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?
Reply
#2

Try updating sscanf or post your script lines.
Reply
#3

Show you script code.
and Nice fake server banner you got their on your signature.
Attracting players.
Reply
#4

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);
    }
}
Reply
#5

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.
Reply
#6

@Clarence,

Did not know, can script,
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)