SA-MP Forums Archive
Little Confusion - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Little Confusion (/showthread.php?tid=218724)



Little Confusion - iRemix - 30.01.2011

Hi,

Just wondering if you could help me.

I've got some code I started working on earlier and I came across something which stumped me.

pawn Код:
dcmd_addorg(playerid, params[])
{
     new iD, oName[128];
     if(sscanf(params, "is", iD, oName)) return SendClientMessage(playerid, COLOR_RED, "~ Incorrect Usage: /addorg [orgid] [orgname]);
     {
          //bla
     }
     return 1;
}
However if I went ingame, and did /addorg 1 San Andreas Police Department
it wouldn't work because ive got spaces between the San Andreas Police Department how can I make it so I can have spaces in the org name?


Re: Little Confusion - admantis - 30.01.2011

I dont use sscanf to much but I've realised something.
pawn Код:
if(sscanf(params, "is", iD, oName)) return SendClientMessage(playerid, COLOR_RED, "~ Incorrect Usage: /addorg [orgid] [orgname]);

// has to be

if(sscanf(params, "
is[128]", iD, oName)) return SendClientMessage(playerid, COLOR_RED, "~ Incorrect Usage: /addorg [orgid] [orgname]);



Re: Little Confusion - iRemix - 30.01.2011

No it doesn't.


Re: Little Confusion - admantis - 30.01.2011

Quote:
Originally Posted by iRemix
Посмотреть сообщение
No it doesn't.
wait, i think your right, nvm, sorry.


Re: Little Confusion - Vince - 30.01.2011

The plugin version of sscanf does need the array sizes declared. And as far as I know, a string with spaces should work if it is the last param.


Re: Little Confusion - [L3th4l] - 30.01.2011

pawn Код:
dcmd_addorg(playerid, params[])
{
     new iD;
     if(sscanf(params, "is", iD, params)) return SendClientMessage(playerid, COLOR_RED, "~ Incorrect Usage: /addorg [orgid] [orgname]");
     {
          //bla
     }
     return 1;
}