SA-MP Forums Archive
sscanf issue - 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 issue (/showthread.php?tid=640038)



sscanf issue - bugmenotlol - 27.08.2017

hi.
i have the issue with a crack command.
code
Code:
new var1,var2,var3
if(sscanf(params)"iii",var1,var2,var3)
{
      SendClientMessage(playerid,red,"syntax wrong"):
}
else {
// it entered here
}
i am not getting any error but it always show wrongsyntax and var1,var2,var3 is numbers
anything wrong ??
thnx in advance


Re: sscanf issue - skuller12 - 27.08.2017

Solve:

Code:
if(sscanf(params, "iii", var1, var2, var3))
Example:

Code:
cmd:test(playerid, params[])
{
new id, money, n[24], str[256];
if(sscanf(params, "ui", id, money)) return SendClientMessage(playerid, -1, "/test <playerid/player name> <money>");
{
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "* Wrong ID or name.");
GivePlayerMoney(id, money);
GetPlayerName(playerid, n, 24);
format(str, 256, "%s given you $%d.", n, money);
SendClientMessage(id, -1, str);
}
return 1;
}



Re: sscanf issue - bugmenotlol - 27.08.2017

it was not helpful
stil cantvmake ut work


Re: sscanf issue - skuller12 - 27.08.2017

you have "#include <sscanf2>" ?


Re: sscanf issue - bugmenotlol - 27.08.2017

yes it works with one var1 but does not work with var2 and var1


Re: sscanf issue - Dayrion - 27.08.2017

Quote:
Originally Posted by bugmenotlol
View Post
hi.
i have the issue with a crack command.
code
Code:
new var1,var2,var3
if(sscanf(params)"iii",var1,var2,var3)
{
      SendClientMessage(playerid,red,"syntax wrong"):
}
else {
// it entered here
}
i am not getting any error but it always show wrongsyntax and var1,var2,var3 is numbers
anything wrong ??
thnx in advance
You should try something like that:
PHP Code:
if(sscanf(params"iii"var1var2var3))
    return 
SendClientMessage(playerid,red," wrong syntax"):
// other code 



Re: sscanf issue - skuller12 - 27.08.2017

show me your command complete