CMD trouble (sscanf)
#1

look down
Код:
CMD:menu(playerid, params[])
{
    new title, columns, Float:x, Float:y, Float:col1width, Float:col2width;
    if(sscanf(params, "sdffff", title, columns, Float:x, Float:y, Float:col1width, Float:col2width)) return SendClientMessage(playerid, -1, "Usage: CreateMenu(title, columns, Float:x, Float:y, Float:col1width, Float:col2width);");
    {
        CreateMenu(title, columns, Float:x, Float:y, Float:col1width, Float:col2width); //bad first argument
    }
    return 1;
}
Reply
#2

You're indicating to sscanf that "title" is a string, but you've defined it as an integer. I would also recommend placing the string as the last parameter, because strings may have spaces and you may confuse sscanf parsing system.

Код:
CMD:menu(playerid, params[])
{
    new title[32], columns, Float:x, Float:y, Float:col1width, Float:col2width;
    if(sscanf(params, "dffffs", columns, Float:x, Float:y, Float:col1width, Float:col2width, title)) return SendClientMessage(playerid, -1, "Usage: CreateMenu(columns, Float:x, Float:y, Float:col1width, Float:col2width, title);");
    {
        CreateMenu(title, columns, Float:x, Float:y, Float:col1width, Float:col2width);
    }
    return 1;
}
Reply
#3

Plus, you have to define a size for the 's' specifier.

Example:
pawn Код:
if(sscanf(params, "s[32]", title)) return SendClientMessage(playerid, -1, "Title");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)