SA-MP Forums Archive
Setstat cmd problem - 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: Setstat cmd problem (/showthread.php?tid=607994)



Setstat cmd problem - N0FeaR - 26.05.2016

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;




Re: Setstat cmd problem - F1N4L - 26.05.2016

Make a debug and see which are functions are being called.


Re: Setstat cmd problem - zDivine - 26.05.2016

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