Why doesent this work?
#1

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);
}
Reply
#2

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;
}
Reply
#3

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)