Problem
#1

Whenever a death occurs in my gamemode, it sends the death message to the right twice instead of once.
Reply
#2

Lets see the OnPlayerDeath code
Reply
#3

um, is this code here the same as urs?
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);
    return 1;
}
to other dude: nou
Reply
#4

The only reason it would "SendDeathMessage" twice is if your scripting it twice....
Reply
#5

Here it is:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new playercash;
    if(killerid == INVALID_PLAYER_ID) {
        SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
        ResetPlayerMoney(playerid);
    } else {
            SendDeathMessage(killerid,playerid,reason);
            SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
            playercash = GetPlayerMoney(playerid);
            if (playercash > 0)  {
                GivePlayerMoney(killerid, playercash);
                ResetPlayerMoney(playerid);
            }
            else
            {
            }
        }
    return 1;
}
Reply
#6

You don't have to SendDeathMessage for an invalid killer. Just get rid of all your 'SendDeathMessage's and just put only one above the return 1.
pawn Код:
SendDeathMessage(killerid,playerid,reason);//if killerid is invalid, it will take care of it for you.
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)