SA-MP Forums Archive
help stats show other players - 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: help stats show other players (/showthread.php?tid=533262)



help stats show other players - Last_Shadow - 23.08.2014

hi i have a problem with my script,i want to show player stats k/d ,it working but it show one time my stats and other time other player stats can u fix my code?

forward TimerUpdate();
public TimerUpdate()
{
new string[256],strg[256],name[MAX_PLAYER_NAME];
for(new i=0;i<MAX_PLAYERS;i++)
{
if (IsPlayerConnected(i))
{
new Kills;
new string[64];
switch(GetPlayerLevel(playername)){
case 0:Kills = Level1; case 1:Kills = Level2; case 2:Kills = Level3;
case 3:Kills = Level4; case 4:Kills = Level5; case 5:Kills = Level6;
case 6:Kills = Level7; case 7:Kills = Level8; case 8:Kills = Level9;
case 9:Kills = Level10; case 10:Kills = Level11; case 11:Kills = Level12;
case 12:Kills = Level13; case 13:Kills = Level14; case 14:Kills = Level15;
case 15:Kills = Level16; case 16:Kills = Level17; case 17:Kills = Level18;
case 18:Kills = Level19; case 19:Kills = Level20; case 20:Kills = Level21;
case 21:Kills = Level22; case 22:Kills = Level23; case 23:Kills = Level24;
case 24:Kills = Level25; case 25:Kills = 0; default:Kills = 0;
}
part[i] = Kills/9;
part2[i] = dini_Int(PlayerFile(playername),"Kills");
// format(PosString, sizeof(string),"- %d %d",dini_Int(PlayerFile(playername),"Kills"),Kil ls/9);
format(string, sizeof(string),"~b~stats: %d/~g~%d",dini_Int(PlayerFile(playername),"Kills"),Ki lls /9);
SendClientMessageToAll(COLOR_LIGHTGREEN, string);

}

}
return 1;
}

so i need it to show per player his stats and not mass all


Re: help stats show other players - theLegion - 23.08.2014

Use
Quote:

SendClientMessage(i,-1,string);

instead of
Quote:

SendClientMessageToAll(COLOR_LIGHTGREEN,string);




Re: help stats show other players - Last_Shadow - 23.08.2014

no haha
im using this with textdraw the
"

format(string, sizeof(string),"~b~stats: %d/~g~%d",dini_Int(PlayerFile(playername),"Kills"),Ki lls /9);
SendClientMessageToAll(COLOR_LIGHTGREEN, string);
"
is only to check if it working.
my problem is that the stats are not showing the correct stats,for example id 0 see id1 and id 1 see 0 and i want id 0 to seee id 0 stats and id1 to see id 1..


Re: help stats show other players - theLegion - 23.08.2014

Again, use the code I posted.

It should work.