Setstat cmd problem
#1

The cmd works but it doesn't give me the level i set so maybe you guys know whats wrong here, thanks in advance!

PHP код:
CMD:setstat(playeridparams[])
{
    new 
type[128],targetid,amount,string[128],name[30],filestring[79];
    if(
sscanf(params"s[30]s[128]i"nametypeamount))
    {
        
SendClientMessage(playeridCOLOR_GREY"USAGE: /setstat [Firstname_Lastname] [stat code] [amount]");
        
SendClientMessage(playeridCOLOR_GREY"| Level, |");
    }
    else
    {
        if(
PlayerInfo[playerid][pAdmin] >= 2)
        {
            if(
strcmp(type"level"true) == 0)
            {
                if(
IsPlayerConnected(targetid)) PlayerInfo[targetid][pLevel] = amountSetPlayerScore(PlayerInfo[targetid][pLevel]);
                else
                   {
                       
format(filestringsizeof(filestring), "Users/%s.ini"name);
                       if(
fexist(filestring))
                       {
                           new 
INI:File INI_Open(filestring);
                        
INI_SetTag(File"Account Info");
                        
INI_WriteInt(File"Level"amount);
                        
INI_Close(File);
                    }
                    else
                    {
                        
SendErrorMessage(playerid"The player you selected doesn't exist.");
                        return 
1;
                    }
                }
                
format(stringsizeof(string),"You have setted %s's %s to %d",name,type,amount);
                
SendClientMessage(playeridCOLOR_GREYstring);
            }
          }
      }
       return 
1;

Reply
#2

Make a debug and see which are functions are being called.
Reply
#3

Pro tip: Don't use INI, use SQLite or MySQL.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)