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



sscanf problem - marik1322 - 17.10.2011

i have a command that working and everything ok
but the problem is that every time when i use the command
the console write me
Quote:

sscanf warning: format specifier does not match parameter count.

the command.
PHP код:
       command(adpilplayeridparams[])
       {
       if(
AdminLevel[playerid] == 1337)
       {
    new 
string[128];
    new 
ID;
    if(
sscanf(params"ui"ID))
    {
        
SendClientMessage(playeridRed"Usage: /adpil (PlayerID)");
        return 
1;
    }
    if(!
IsPlayerConnected(ID))
    {
        
SendClientMessage(playeridRed"That player ID is not connected.");
        return 
1;
    }
    if(
PlayerLevel[ID] > 200)
    {
        
SendClientMessage(playeridGreen"That player is already a pilot or higher.");
        return 
1;
    }
     new 
pname[128];
     
GetPlayerName(IDpnamesizeof(pname));
     
format(stringsizeof(string), "Server Admin has made player %s a War Pilot."pname);
     
SendClientMessageToAll(Bluestring);
      
SendClientMessage(IDBlue"Server Admin has given you Pilot Status. You can now fly the Rustlers, 
      IRC_Say(gGroupID, IRC_CHANNEL, string);
    PlayerLevel[ID] =200;
       TextDrawHideForPlayer(playerid, himessage);
        new newtext[41];
    format(string, sizeof(string), "
Level:%d", PlayerLevel[playerid]);
    TextDrawSetString(himessage, string);
        TextDrawShowForPlayer(playerid, himessage);
    return 1;
    }
    SendClientMessage(playerid, Red, "
Invalid Command");
    return 1;

the problem start when i put that i command
PHP код:
        new newtext[41];
    
format(newtextsizeof(newtext), "Level:%d"PlayerLevel[playerid]);
    
TextDrawSetString(himessagenewtext);
        
TextDrawShowForPlayer(playeridhimessage); 



Re: sscanf problem - Kush - 17.10.2011

You enlist 'i' which specifies and integer, though you do not use it?

PHP код:
if(sscanf(params"u"ID)) 



Re: sscanf problem - marik1322 - 17.10.2011

it still writing that


Re: sscanf problem - [Diablo] - 17.10.2011

i think you don't need "i" specifier. try

pawn Код:
if(sscanf(params, "u", ID))



Re: sscanf problem - marik1322 - 17.10.2011

yea man tnx !!!!!!!!!
working


Re: sscanf problem - [Diablo] - 17.10.2011

you're welcome.


Re: sscanf problem - Kush - 17.10.2011

PHP код:
COMMAND:adpil(playeridparams[]) {
    new
        
string[128],
        
id,
        
plname[MAX_PLAYER_NAME],
        
newtext[41];
      
GetPlayerName(idplnamesizeof(plname));
    if(
AdminLevel[playerid] != 1337) return 0;
    if(
sscanf(params"u"id)) return SendClientMessage(playerid, -1"USAGE: adpil [playerid]");
    if(!
IsPlayerConnected(id)) return 0;
    if(
PlayerLevel[id] == 200) return SendClientMessage(playerid, -1"Player is already pilot");
    
format(stringsizeof(string), "Server Admin has made player %s a War Pilot."pname);
         
SendClientMessageToAll(Bluestring);
          
SendClientMessage(idBlue"Server Admin has given you Pilot Status. You can now fly the Rustlers!");
          
IRC_Say(gGroupIDIRC_CHANNELstring);
    
PlayerLevel[id] = 200;
    
TextDrawHideForPlayer(playeridhimessage);
    
format(stringsizeof(string), "Level:%d"PlayerLevel[playerid]);
        
TextDrawSetString(himessagestring);
        
TextDrawShowForPlayer(playeridhimessage);
        
    return 
1;

Re-done, untested.