SA-MP Forums Archive
Why doesent this work? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Why doesent this work? (/showthread.php?tid=195112)



Why doesent this work? - ThePwherer - 01.12.2010

i have this script and i dont know how to make it work.
For example SendClientMessageToAll( 0xFF0000FF, "%s has been killed by (i dont know how to add the killers name)");
And when it adds a score it doesent save it.


public OnPlayerDeath(playerid, killerid, reason)
{
new player[24];
new killer[24];
GetPlayerName(playerid, player, sizeof(player));
GetPlayerName(killerid, killer, sizeof(killer));
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
}


Re: Why doesent this work? - Biesmen - 01.12.2010

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new player[24], killer[24], string[128];
GetPlayerName(playerid, player, sizeof(player));
GetPlayerName(killerid, killer, sizeof(killer));
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);

format(string, sizeof(string), "%s[%i] has killed %s[%i]!", killer, killerid, player, playerid);
SendClientMessageToAll(0xFF0000FF, string);
return 1;
}
Edit:
I just noticed you want the message "Has been killed by".
Use this code for that message:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new player[24], killer[24], string[128];
GetPlayerName(playerid, player, sizeof(player));
GetPlayerName(killerid, killer, sizeof(killer));
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);

format(string, sizeof(string), "%s[%i] has been killed by %s[%i]!", player, playerid, killer, killerid);
SendClientMessageToAll(0xFF0000FF, string);
return 1;
}



Re: Why doesent this work? - ThePwherer - 01.12.2010

Great thannks but do you know how to make the score rise from one higher and higher?


Re: Why doesent this work? - Biesmen - 01.12.2010

pawn Код:
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
Your code is correct, it should work.