show stats help - 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: show stats help (
/showthread.php?tid=292762)
show stats help -
Tom1412 - 25.10.2011
I'm making a rp gamemode,
But when i do /stats it shows the stats except
Shows admin level correct
It shows the other stats as i1/4
Also if they is stats as 0 the ones that show as i1/4 dont show nothing.
pawn Код:
forward ShowStats(playerid);
public ShowStats(playerid)
{
if(IsPlayerConnected(playerid)&&IsPlayerConnected(playerid))
{
new Admin = PlayerInfo[playerid][pAdmin];
new Cash = GetPlayerMoney(playerid);
new Kills = PlayerInfo[playerid][pKills];
new Deaths = PlayerInfo[playerid][pDeaths];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new coordsstring[256];
SendClientMessage(playerid, Stats_Color, "Your Stats");
format(coordsstring, sizeof(coordsstring), " Admin Level: %d | Cash: %s | Kills: %s | Deaths: %s |", Admin, Cash, Kills, Deaths);
SendClientMessage(playerid, Stats_Color,coordsstring);
}
}
Re: show stats help -
StuffBoy - 25.10.2011
pawn Код:
forward ShowStats(playerid);
public ShowStats(playerid)
{
if(IsPlayerConnected(playerid)&&IsPlayerConnected(playerid))
{
new Admin = PlayerInfo[playerid][pAdmin];
new Cash = GetPlayerMoney(playerid);
new Kills = PlayerInfo[playerid][pKills];
new Deaths = PlayerInfo[playerid][pDeaths];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new coordsstring[256];
SendClientMessage(playerid, Stats_Color, "Your Stats");
format(coordsstring, sizeof(coordsstring), " Admin Level: %d | Cash: %d | Kills: %d | Deaths: %d |", Admin, Cash, Kills, Deaths);
SendClientMessage(playerid, Stats_Color,coordsstring);
}
}
you was using strings ( %s ) on the other three variables
Re: show stats help -
SampEver1 - 25.10.2011
Код:
forward ShowStats(playerid);
public ShowStats(playerid)
{
if(IsPlayerConnected(playerid)&&IsPlayerConnected(playerid))
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new coordsstring[256];
SendClientMessage(playerid, Stats_Color, "Your Stats");
format(coordsstring, sizeof(coordsstring), " Admin Level: %d | Cash: %s | Kills: %s | Deaths: %s |",PlayerInfo[playerid][pAdmin]; , GetPlayerMoney(playerid); , PlayerInfo[playerid][pKills]; , PlayerInfo[playerid][pDeaths];);
SendClientMessage(playerid, Stats_Color,coordsstring);
}
}
Not tested but it should work Easy ?
Re: show stats help -
StuffBoy - 25.10.2011
Quote:
Originally Posted by SampEver1
Not tested but it should work Easy ?
|
You have only changed the way the variables are used the problem was that he used strings with integers and it fucked up.
Re: show stats help -
Tom1412 - 25.10.2011
Thanx guys for the help.
what is the difference between %s and %d ?
I am am still learning
Re: show stats help -
=WoR=Varth - 25.10.2011
https://sampwiki.blast.hk/wiki/Format
Re: show stats help -
Tom1412 - 25.10.2011
thanx for the help