SA-MP Forums Archive
[HELP] With 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: [HELP] With sscanf (/showthread.php?tid=353835)



[HELP] With sscanf - V4at - 24.06.2012

When was the "zcmd" everything was fine, but now when is on "cmdtext" in text indicates a command /sg should show "USAGE: /sg [text]"

Код:
if(strcmp(cmdtext, "/sg", true) == 0)
{
  new pranesimas2[150], vardas[MAX_PLAYER_NAME];
  if(GetPlayerSkin(playerid) == 105 || GetPlayerSkin(playerid) == 106 || GetPlayerSkin(playerid) == 107)
  {
  if(sscanf(cmdtext,"s",pranesimas2)) return SendClientMessage(playerid,raudona,"USAGE: /sg [text]");
  GetPlayerName(playerid, vardas, sizeof(vardas));
  format( string, sizeof(string), "* Gang Grove member %s: %s", vardas, pranesimas2);
  SendClientMessageToAll(COLOR_LIMEGREEN, string);
  } else SendClientMessage(playerid,raudona,"[FunZoneLT]>> You are not this gang member.");
  return 1;
}



Re: [HELP] With sscanf - Badger(new) - 24.06.2012

Hello.

The variable "cmdtext" contains the WHOLE command.
E.g. If you typed "/sg hello" cmdtext would equal "/sg hello".

Sscanf isn't reporting that it can't find a string because when you type "/sg", cmdtext is equal to "/sg", so sscanf can find a string.


What you need to do is remove the command the player types manually, or use ONE of the two following includes:
ZCMD- Fastest command processor https://sampforum.blast.hk/showthread.php?tid=91354
YCMD- Second fastest (not far off) and offers more features https://sampforum.blast.hk/showthread.php?tid=169029


Re: [HELP] With sscanf - Vince - 24.06.2012

This might work as well:
pawn Код:
if(sscanf(cmdtext,"{s[128]}s[128]",pranesimas2))
where the first "s" is a quiet, unsaved param containing the command name.

But as said:
Quote:
Originally Posted by Badger(new)
Посмотреть сообщение
ZCMD- Fastest command processor https://sampforum.blast.hk/showthread.php?tid=91354
YCMD- Second fastest (not far off) and offers more features https://sampforum.blast.hk/showthread.php?tid=169029