/stats doesn't work... Why? please :D
#1

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

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

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;
Reply
#4

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

For displaying a Number use %d, For displaying a String use %s
Reply
#6

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

That is what i thought from the beginning xD Thanks guys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)