CMD trouble (sscanf) - 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: CMD trouble (sscanf) (
/showthread.php?tid=564616)
CMD trouble (sscanf) -
cnoopers - 22.02.2015
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;
}
Re: CMD trouble (sscanf) -
admantis - 22.02.2015
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;
}
Re: CMD trouble (sscanf) -
AndySedeyn - 22.02.2015
Plus, you have to define a size for the 's' specifier.
Example:
pawn Код:
if(sscanf(params, "s[32]", title)) return SendClientMessage(playerid, -1, "Title");