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=568617)



sscanf problem - kepa333 - 23.03.2015

SLOVED:

Converted all commands into dialogs! lel.


Re: sscanf problem - Ciarannn - 23.03.2015

Quote:
Originally Posted by kepa333
Посмотреть сообщение
pawn Код:
if(!sscanf(params, "s[128]", params))
    {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gedit [option] [gateid]");
        SendClientMessage(playerid, COLOR_GREY, "OPTIONS: object | close | open | speed | password");
        return 1;
    }
Change:
pawn Код:
if(!sscanf(params, "s[128]", params))
To this:
pawn Код:
if(sscanf(params, "s[128]", params))



Re: sscanf problem - kepa333 - 23.03.2015

Quote:
Originally Posted by Ciarannn
Посмотреть сообщение
Change:
pawn Код:
if(!sscanf(params, "s[128]", params))
To this:
pawn Код:
if(sscanf(params, "s[128]", params))
I'been playing with this code for 2 hours,

pawn Код:
if(sscanf(params, "s[128]", params))
this was made in original code and it dosen't work :S


Re: sscanf problem - Ciarannn - 23.03.2015

Quote:
Originally Posted by kepa333
Посмотреть сообщение
I'been playing with this code for 2 hours,

pawn Код:
if(sscanf(params, "s[128]", params))
this was made in original code and it dosen't work :S

Try this:

pawn Код:
if(sscanf(params, "s[128]i", params, idx))
Sorry about the last reply, I didn't realize that there where two problems with the code.


Re: sscanf problem - kepa333 - 23.03.2015

It's still same... cant pass first msg.


Re: sscanf problem - SickAttack - 23.03.2015

Here's an example:
pawn Код:
CMD:gedit(playerid, params[])
{
    new option[128], gateid;
    if(sscanf(params, "s[128]i", option, gateid))
    {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gedit [option] [gateid]");
        SendClientMessage(playerid, COLOR_GREY, "OPTIONS: object | close | open | speed | password");
        return 1;
    }

    if(strcmp(option, "object", true) == 0)
    {
        // Code...
    }
    else if(strcmp(option, "close", true) == 0)
    {
        // Code...
    }
    else if(strcmp(option, "open", true) == 0)
    {
        // Code...
    }
    else if(strcmp(option, "speed", true) == 0)
    {
        // Code...
    }
    else if(strcmp(option, "password", true) == 0)
    {
        // Code...
    }
    else
    {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gedit [option] [gateid]");
        SendClientMessage(playerid, COLOR_GREY, "OPTIONS: object | close | open | speed | password");
    }
    return 1;
}
And I suggest that you leave the issue on the main post for future issues which are similar to yours.