[HELP] sscanf2.0
#1

pawn Code:
if(strcmp(mCommand, "hide", true) == 0)
    {
      if(PlayerInfo[playerid][Level] >= 3)
      {
        new sCommand[4];
        if(sscanf(params, "s[20]s[4]",mCommand, sCommand))
                {
                     SendClientMessage(playerid, Red, "USAGE: /my hide [on/off]");
                }
        else if(strcmp(sCommand, "on", true) == 0)
        {
                    if(PlayerInfo[playerid][Hidden] == 1) return SendClientMessage(playerid, Red, "You are already 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;
                }
                else 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;
        }
    }
There is my command, which works perfectly, except if you type /my hide and then "on" or "off" nothing at all happens, no messages nothing. Please, can somebody tell me what the fuck I am doing wrong. I have countless other commands like this that just aren't working.... I can't see anything wrong with it.
Reply
#2

BUMP. Somebody's gotta know what the fuck is going on. I don't care if Y_Less himself has to get his ass up in here, need this sorted.
Reply
#3

sscanf returns 0 if your string matches your specifiers, so add a ! inside the if statement before the sscanf.
Reply
#4

Quote:
Originally Posted by Kyosaur!!
sscanf returns 0 if your string matches your specifiers, so add a ! inside the if statement before the sscanf.
That failed. Didn't even work, lol. Any other solutions?
Reply
#5

Quote:
Originally Posted by _❼_
Quote:
Originally Posted by Kyosaur!!
sscanf returns 0 if your string matches your specifiers, so add a ! inside the if statement before the sscanf.
That failed. Didn't even work, lol. Any other solutions?
Being a dickhead won't get you help. He tries to help and you dont even say thanks to him for even bothering! Just so you know.
Reply
#6

I wasn't being a dickhead, I just merely forgot to thank him. However, you're retarded. Don't post here unless you have some help (as the topic title says), thanks.



P.S: That's being a dickhead.
Reply
#7

Does anybody on earth know why this isn't working?! I can't do anything until this is fixed!!! I PM'd Y_Less but no reply, as I expected.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)