[HELP] With sscanf
#1

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;
}
Reply
#2

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
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)