OnPlayerDeath[+REP]
#1

Hello,
Can u help me with OnPlayerDeath.I will rep u.
How can i send a clientmessage to everyone per 1 star i get by killing someone.
Reply
#2

like this?
pawn Код:
stock Name(playerid)
{
new name[25];
GetPlayerName(playerid, name, 24);
return name;
}

OnPlayerDeath(playerid, killerid, reason)
{
if(killerid == INVALID_PLAYER_ID)return 1;
new str[150];
format(str, 150, "**{ff0000}%s {ffffff}killed {ff0000}%s",Name(killerid), Name(playerid));
SendClientMessageToAll(-1, str);
return 1;
}
Reply
#3

nono.
I mean.If player has 2 stars an announcement will be on server saying"%s has 2 stars and won 20 percent armor"
and it gives to the killerid 20 percent armor.
Reply
#4

pawn Код:
stock Name(playerid)
{
new name[25];
GetPlayerName(playerid, name, 24);
return name;
}

OnPlayerDeath(playerid, killerid, reason)
{
if(killerid == INVALID_PLAYER_ID)return 1;
new str[200];
format(str, 150, "**{ff0000}%s {ffffff}had {ff0000}%i {ffffff}wanted level and {ff0000}%s {ffffff}received {ff0000}&i {ffffff}percent armor for killing him.",Name(playerid), GetPlayerWantedLevel(playerid), Name(killerid), (GetPlayerWantedLevel(playerid)*10));
SendClientMessageToAll(-1, str);
new Float:a;
GetPlayerArmour(killerid, a);
SetPlayerArmour(killerid, (a+(GetPlayerWantedLevel(playerid)*10) ) );
SetPlayerWantedLevel(playerid, 0);
return 1;
}
Reply
#5

repped.
Reply
#6

Bear in mind that code isn't indented properly. Whilst it will probably not give you any warnings, it is hard to read.

Code should really be indented properly because it will help you in the long run so much.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)