sscanf help
#1

Hello guys, I changed the type of the command creation, using sscanf, but when I'm trying to create sscanf with string, it always says: Usage: ....
Here is my code:
PHP код:
cmd:F(playeridparams[])
{
        new 
result[64];
    if(
sscanf(params"s[64]"result))
    {
        return 
SendClientMessage(playeridCOLOR_WHITE"Usage: /F [Text]");
    }
        return 
1;

Reply
#2

Remove those brackets and put return on same line as sscanf(params thing
And move return 1 for 1 tab back
Reply
#3

Thanks m8!
+1 REP!
Reply
#4

Avoid returning SendClientMessage, it's ambiguous and confusing.

pawn Код:
cmd:F(playerid, params[])
{
    new result[64];
    if(sscanf(params, "s[64]", result))
    {
        SendClientMessage(playerid, COLOR_WHITE, "Usage: /F [Text]");
        return 1;
    }
   
    //if the params are correct, then... (add code below)
   
    return 1;
}
Reply
#5

Too late Twizted...
n00blek already helped me, I just removed the brackets from sscanf(params and it works perfect now!
Thanks for trying help but next time look my last reply!
Reply
#6

Quote:
Originally Posted by Twizted
Посмотреть сообщение
Avoid returning SendClientMessage, it's ambiguous and confusing.

pawn Код:
cmd:F(playerid, params[])
{
    new result[64];
    if(sscanf(params, "s[64]", result))
    {
        SendClientMessage(playerid, COLOR_WHITE, "Usage: /F [Text]");
        return 1;
    }
   
    //if the params are correct, then... (add code below)
   
    return 1;
}
"Avoid returning SendClientMessage, it's ambiguous and confusing."
It's not ambiguous and confusing. It's actually a pretty cool way to make 2 lines into 1, and if you want to return the opposite value of SendClientMessage, just write ! before it, and it'll return 0;. So just keep it using like that.
Reply
#7

Quote:
Originally Posted by Kraeror
Посмотреть сообщение
Too late Twizted...
n00blek already helped me, I just removed the brackets from sscanf(params and it works perfect now!
Thanks for trying help but next time look my last reply!
I know he helped you. I was just indicating a best practise (which apparently is subjective).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)