Random player death message
#1

pawn Код:
//RANDOM DEATH MESSAGES
new RandomDeath[][] =
{
    "was killed by",
    "was fragged by",
    "was ended by",
    "was pulverized by"

};

new RandomSuicide[][] =
{
    "committed suicide",
    "took thier own life",
    "messed up"
};
For the sake of putting my code on here, i changed all those messages from what they really are oin my server xD. Anyway, this is in OnPlayerDeath()
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{

        //OTHER CODE......

    if(!killerid){
   
        GetPlayerName(playerid, kname, MAX_PLAYER_NAME);
        GetPlayerName(killerid, dname, MAX_PLAYER_NAME);
        format(allmessage, sizeof(allmessage), "{00FF00}%s{FFFFFF} %s {00FF00}%s.", kname, RandomDeath[random(sizeof(RandomDeath))], dname);
        SendClientMessageToAll(-1, allmessage);
       
    } else {
        GetPlayerName(playerid, dname, MAX_PLAYER_NAME);
        format(allmessage, sizeof(allmessage), "{00FF00}%s{FFFFFF} %s", dname, RandomSuicide[random(sizeof(RandomSuicide))]);
        SendClientMessageToAll(-1, allmessage);
    }

    //OTHER CODE....

}
When a user dies, it just displays a random message from either one, for instance, if I commit suicide, sometimes it will say "USERNAME got killed by" and if I get killed by someone else, sometimes the message will be something like "USERNAME committed suicide"

Anyone see why?
Reply
#2

What happens if you change

if(!killerid)

to

if(killerid != playerid)

??
Reply
#3

Actually it should be
pawn Код:
if(killerid != INVALID_PLAYER_ID)
Reply
#4

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
What happens if you change

if(!killerid)

to

if(killerid != playerid)

??
Quote:
Originally Posted by Vince
Посмотреть сообщение
Actually it should be
pawn Код:
if(killerid != INVALID_PLAYER_ID)
thanks to both of you
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)