09.06.2012, 05:38
pawn Код:
public UpdateStats(playerid)
{
for(new i; i < MAX_PLAYERS; i++)// this is to find the playerid
{
if(IsPlayerConnected(i))
{
i = playerid;
}
}
new
str[128],
Float:ratio,
k,d;
if((PlayerInfo[playerid][Kills] != 0) && PlayerInfo[playerid][Deaths] == 0)//just a script to work out a kill death ratio
{
ratio = 100.00;
}
else
{
ratio = floatdiv(PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths]);
}
k = PlayerInfo[playerid][Kills];
d = PlayerInfo[playerid][Deaths];
format(str,sizeof(str),"~r~K: ~w~%d | ~r~D: ~w~%d | ~r~K/D: ~w~%.2f ",k,d,ratio);
TextDrawSetString(TotalStats[playerid],str);
SendClientMessage(playerid,WHITE,str);
TextDrawShowForPlayer(playerid, str); //Add this
return 1;
}