SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Scripting Help (https://forum.sa-mp.com/forumdisplay.php?f=12)
-   -   sscanf issue (https://forum.sa-mp.com/showthread.php?t=640038)

bugmenotlol 27/08/2017 08:52 AM

sscanf issue
 
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

skuller12 27/08/2017 09:55 AM

Re: sscanf issue
 
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;
}


bugmenotlol 27/08/2017 12:04 PM

Re: sscanf issue
 
it was not helpful
stil cantvmake ut work

skuller12 27/08/2017 12:27 PM

Re: sscanf issue
 
you have "#include <sscanf2>" ?

bugmenotlol 27/08/2017 12:50 PM

Re: sscanf issue
 
yes it works with one var1 but does not work with var2 and var1

Dayrion 27/08/2017 12:54 PM

Re: sscanf issue
 
Quote:

Originally Posted by bugmenotlol (Post 3919854)
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 


skuller12 27/08/2017 01:56 PM

Re: sscanf issue
 
show me your command complete


All times are GMT. The time now is 11:53 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.