show stats help
#1

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

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

Код:
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 ?
Reply
#4

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.
Reply
#5

Thanx guys for the help.

what is the difference between %s and %d ?

I am am still learning
Reply
#6

https://sampwiki.blast.hk/wiki/Format
Reply
#7

thanx for the help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)