OnPlayerDeath[+REP] - 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: OnPlayerDeath[+REP] (
/showthread.php?tid=536214)
OnPlayerDeath[+REP] -
[SU]Spartan - 08.09.2014
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.
Re: OnPlayerDeath[+REP] -
BroZeus - 08.09.2014
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;
}
Re: OnPlayerDeath[+REP] -
[SU]Spartan - 08.09.2014
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.
Re: OnPlayerDeath[+REP] -
BroZeus - 08.09.2014
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;
}
Re: OnPlayerDeath[+REP] -
[SU]Spartan - 08.09.2014
repped.
Re: OnPlayerDeath[+REP] -
PrivatioBoni - 08.09.2014
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.