SA-MP Forums Archive
/stats doesn't work... Why? please :D - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /stats doesn't work... Why? please :D (/showthread.php?tid=68429)



/stats doesn't work... Why? please :D - introzen - 10.03.2009

Okey, I just made this /stats command and i don't understand why it aint working.. but i'm sure some of you do

pawn Код:
dcmd_stats(playerid)
    {
        new pName[MAX_PLAYER_NAME],string[256];
        GetPlayerName(playerid,pName,sizeof(pName));
        format(string,sizeof(string),"EQRP/Players/%s.ini",pName);
        new Bank,Money,DriverLic,WeaponLic,Faction,AdminLVL,Skin,Jailed,Leader;
       
        Bank = dini_Int(string,"Bank");
        Money = GetPlayerMoney(playerid);
        DriverLic = dini_Int(string,"DriverLic");
        WeaponLic = dini_Int(string,"WeaponLic");
        Faction = dini_Int(string,"Faction");
        AdminLVL = dini_Int(string,"AdminLVL");
        Skin = dini_Int(string,"Skin");
        Jailed = dini_Int(string,"Jailed");
        Leader = dini_Int(string,"Leader");
       
        new string1[256], string2[256], string3[256];
        format(string1,sizeof(string1),"Bank($%s) Money($%s) DriverLic(%s)",Bank,Money,DriverLic);
        format(string2,sizeof(string2),"WeaponLic(%s) Faction(%s) AdminLVL(%s)",WeaponLic,Faction,AdminLVL);
        format(string3,sizeof(string3),"Skin(%s) Jailed(%s) Leader(%s)",Skin,Jailed,Leader);
       
        SendClientMessage(playerid,COLOR_GREEN,"__________PlayerStats__________");
        SendClientMessage(playerid,COLOR_WHITE,string1);
        SendClientMessage(playerid,COLOR_WHITE,string2);
        SendClientMessage(playerid,COLOR_WHITE,string3);
        SendClientMessage(playerid,COLOR_GREEN,"_______________________________");
        return 1;
    }



Re: /stats doesn't work... Why? please :D - ICECOLDKILLAK8 - 10.03.2009

1) Why are all your strings defined as 256, You dont need it
2) What happens when you type it?


Re: /stats doesn't work... Why? please :D - Dujma - 10.03.2009

Because you used string for numerics

I belive that Bank, Money, Skin, AdminLVL, Jailed is numeric? Like Money: $123132

What shoud be DriverLic, Faction, WeaponLic, Leader? Should it be like DriverLic: Yes or DriverLic: 1 or 0

I see that here you dont have any size defined so it must be an numeric am I right?

new Bank,Money,DriverLic,WeaponLic,Faction,AdminLVL,Sk in,Jailed,Leader;


Re: /stats doesn't work... Why? please :D - introzen - 10.03.2009

none of those returns a string... the %s.ini looks like:

hash=********
Password=****
Money=158246
Bank=300600
DriverLic=0
WeaponLic=0
Faction=1
AdminLVL=1337
Skin=115
Weapon=0
Ammo=65535
Banned=0
Jailed=0
Leader=1



Re: /stats doesn't work... Why? please :D - ICECOLDKILLAK8 - 10.03.2009

For displaying a Number use %d, For displaying a String use %s


Re: /stats doesn't work... Why? please :D - Dujma - 10.03.2009

Quote:
Originally Posted by IntrozeN
none of those returns a string... the %s.ini looks like:

hash=********
Password=****
Money=158246
Bank=300600
DriverLic=0
WeaponLic=0
Faction=1
AdminLVL=1337
Skin=115
Weapon=0
Ammo=65535
Banned=0
Jailed=0
Leader=1
But you use strings here

Код:
format(string1,sizeof(string1),"Bank($%s) Money($%s) DriverLic(%s)",Bank,Money,DriverLic);
format(string2,sizeof(string2),"WeaponLic(%s) Faction(%s) AdminLVL(%s)",WeaponLic,Faction,AdminLVL);
format(string3,sizeof(string3),"Skin(%s) Jailed(%s) Leader(%s)",Skin,Jailed,Leader);
This %s should be %d


Re: /stats doesn't work... Why? please :D - introzen - 10.03.2009

That is what i thought from the beginning xD Thanks guys