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



sscanf warning - [CG]Milito - 17.12.2012

Hello guys!

I was testing a simple command "/adnos" but when i was checking the console, i got a warning:

Quote:

sscanf warning: format specifier does not match parameter count.

PHP код:
dcmd_adnos(playerid,params[])
{
    new 
string[128];
    new 
ID;
    if(
sscanf(params,"us[100]",ID))
    {
        
SendClientMessage(playerid,COLOR_NUB,"USAGE: /adnos (Player Name/ID)");
        return 
1;
    }
    if(
IsSpawned[playerid] != 1)
    {
        
SendClientMessage(playerid,COLOR_NUB,"[ERROR]{FFFFFF}You must be spawned. Otherwise, you can't type this command.");
        return 
1;
    }
    if(!
IsPlayerInAnyVehicle(ID))
    {
        
SendClientMessage(playeridCOLOR_NUB"That player is not in a car, you cannot give him/her nos!");
        return 
1;
    }
    if(!
IsPlayerConnected(ID))
    {
        
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot give him nos.",ID);
        
SendClientMessage(playerid,COLOR_NUB,string);
        return 
1;
    }
    
AddVehicleComponent(GetPlayerVehicleID(ID), 1010);
    
SendClientMessage(playerid,COLOR_YELLOW"[[_NOS_]] You have added nos to his/her car!");
    return 
1;

What does that mean?


Re: sscanf warning - zDevon - 17.12.2012

Well, your command uses only one parameter (player id) though you are defining two in the sscanf line (u - a player, and s - a string that you have not used). Try removing the 's[100]' from
pawn Код:
if(sscanf(params,"us[100]",ID))



Respuesta: sscanf warning - [CG]Milito - 17.12.2012

Thanks dude
+rep