Sscanf Warning, [HELP]
#1

Code:

pawn Код:
CMD:aduneb(playerid, params[])
{
    new id;
    new string[256];
    if(sscanf(params,"ui",id)) return SendClientMessage(playerid, RED, "[USAGE]: /aduneb [id]");
    if(!IsPlayerConnected(id))
    {
        format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot take away his/her EB status.",id);
        SendClientMessage(playerid,RED,string);
        return 1;
    }
    if(IsLoggedIn{id} == 0)
    {
     SendClientMessage(playerid, RED, "Player not logged in.");
        return 1;
    }
    if(CanUseEB[id] != 1337)
    {
        format(string,sizeof(string),"%s(%d) is not an EB member.",GetName(id),id);
        SendClientMessage(playerid,RED,string);
        return 1;
    }
    if(PlayerInfo[playerid][aLevel] >= 3)
    {
    format(string,sizeof(string),"[ADMIN EB] Administrator has taken away %s(%d) EB status.",GetName(id),id);
    SendClientMessageToAll(GREEN,string);
    SendClientMessage(id,GREEN,"You have been taken away EB status by a Server Administrator. What a Mess.");
    CanUseEB[id] =0;
    SaveUserStats(id);
    }
 else
 {
         SendClientMessage(playerid, RED, "Only admin level +3 can use this command.");
 }
    return true;
}

CMD:adeb(playerid, params[])
{
    new id;
    new string[256];
    if(sscanf(params,"ui",id)) return SendClientMessage(playerid, RED, "[USAGE]: /adeb [id]");
    if(!IsPlayerConnected(id))
    {
        format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot give them EB status.",id);
        SendClientMessage(playerid,RED,string);
        return 1;
    }
    if(IsLoggedIn{id} == 0)
    {
     SendClientMessage(playerid, RED, "Player not logged in.");
        return 1;
    }
    if(CanUseEB[id] == 1337)
    {
        format(string,sizeof(string),"%s(%d) is already an EB member.",GetName(id),id);
        SendClientMessage(playerid,RED,string);
        return 1;
    }
    if(PlayerInfo[playerid][aLevel] >= 3)
    {
    format(string,sizeof(string),"[ADMIN EB] Administrator has given %s(%d) EB status.",GetName(id),id);
    SendClientMessageToAll(GREEN,string);
    SendClientMessage(id,GREEN,"You have been given EB status by a Server Administrator. Congratulations.");
    CanUseEB[id] =1337;
    SaveUserStats(id);
    }
 else
 {
         SendClientMessage(playerid, RED, "Only admin level +3 can use this command.");
 }
    return 1;
}

ERROR
Код:
 
sscanf warning: Format specifier does not match parameter count
How to fix it?
Reply
#2

pawn Код:
if(sscanf(params,"u",id)) return SendClientMessage(playerid, RED, "[USAGE]: /aduneb [id]");
Reply
#3

Quote:
Originally Posted by Mr_DjolE
Посмотреть сообщение
pawn Код:
if(sscanf(params,"u",id)) return SendClientMessage(playerid, RED, "[USAGE]: /aduneb [id]");
for both?
Reply
#4

pawn Код:
if(sscanf(params,"i",id)) return SendClientMessage(playerid, RED, "[USAGE]: /adeb [id]");
too much parameters.
Reply
#5

thanks
Reply
#6

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
pawn Код:
if(sscanf(params,"i",id)) return SendClientMessage(playerid, RED, "[USAGE]: /adeb [id]");
too much parameters.
Next time learn2read, I've already posted the answer.
Reply
#7

Quote:
Originally Posted by Mr_DjolE
Посмотреть сообщение
Next time learn2read, I've already posted the answer.
You really have a problem, eh?

He posted 1 minute after you did, but when you type on the "Reply to Thread", you can't see if someone posted before you..

And actually, you don't tell him what the problem is with that.

"u" specifier is used for <ID/Part Of Name> and "i" specifier for integers. If you want only id, use the "i", otherwise you want Name or ID, use the "u" or even the "r".
Reply
#8

Quote:
Originally Posted by Dwane
Посмотреть сообщение
"u" specifier is used for <ID/Part Of Name> and "i" specifier for integers. If you want only id, use the "i", otherwise you want Name or ID, use the "u" or even the "r".
<sarcasm>Thank you for telling me that.</sarcasm>

He will understand it if he's not stupid enough.
Reply
#9

He probably won't understand it, not because he is something you said, which is offensive to him but because he might be new to sscanf. If he knew what was wrong, he wouldn't make a thread for that. You need to explain him, so he won't do the same mistake again and again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)