Issue with sscanf2 and subcommands
#1

Hi, I have a command that handles most of a players stuff. This particular command handles an Administrators "hidden" status, makes him/her invisible. However, when used it doesn't do anything? Is there something I'm doing wrong? I have tried a few variations on the sscanf format, none are working!

params = the command | mCommand = main command (hide) | sCommand = the sub command (on/off)

pawn Код:
if(strcmp(mCommand, "hide", true) == 0)
    {
      if(PlayerInfo[playerid][Level] >= 3)
      {
        new sCommand[3];
        if(sscanf(params, mCommand, "s[3]", sCommand))
                {
                     SendClientMessage(playerid, Red, "USAGE: /my hide [on/off]");
                }
        if(strcmp(sCommand, "on", true) == 0)
        {
                    if(PlayerInfo[playerid][Hidden]) return SendClientMessage(playerid, Red, "You are alreading invisible!");
                    for(new i; i < MAX_PLAYERS; i++)
                    {
                    if(IsPlayerConnected(i) && PlayerInfo[i][Level] < 3)
                        {
                          ShowPlayerNameTagForPlayer(i, playerid, false);
                          SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(playerid) & 0xFFFFFF00));
                        }
                    }
                    format(string, sizeof(string), "%s[%d] is now hidden for players", pName(playerid), playerid);
                MessageToAdminsEx(playerid, MAD_WHITE, string);
                PlayerInfo[playerid][Hidden] = 1;
                SendClientMessage(playerid, MANAGEMENT, "* You are now invisible to players.");
                    return 1;
                }
                if(strcmp(sCommand, "off", true) == 0)
                {
                    if(PlayerInfo[playerid][Hidden] == 0) return SendClientMessage(playerid, Red, "You're hide is already off!");
                    for(new i; i < MAX_PLAYERS; i++)
                    {
                    if(IsPlayerConnected(i) && PlayerInfo[i][Level] < 3)
                        {
                          ShowPlayerNameTagForPlayer(i, playerid, false);
                          SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(playerid)));
                        }
                    }
                    format(string, sizeof(string), "%s[%d] is not invisible anymore.", pName(playerid), playerid);
                MessageToAdminsEx(playerid, MAD_WHITE, string);
                PlayerInfo[playerid][Hidden] = 0;
                SendClientMessage(playerid, MANAGEMENT, "* You are now invisible to players.");
          return 1;
                }
            } else return 0;
        }
Any help is much appreciated.
Reply
#2

BUMPERLICIOUS!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)