OnPlayerKeyStateChange help
#1

Hello.

Problem with OnPlayerKeyStateChange. I want to add two commands under one key: /enter and /exit.

pawn Код:
case KEY_CTRL_BACK:
    {
        return OnPlayerCommandText(playerid, "/enter");
        }
        return 1;
    }
Thats the command /enter i added under the key, i'm not sure, if i done it right way. Maybe someone can help me little bit, how could 2 commands works under one key.

Thanks.
Reply
#2

If you used zCMD, everything would go way easier. (return cmd_input(playerid, params).

I'm a complete stranger when it comes to strcmp but I can try to help you nonetheless. Have you tried this code? If so, did it work?
Reply
#3

I haven't tested it yet, but yea, i'm using strcmp still.
Reply
#4

pawn Код:
case KEY_CTRL_BACK:
{
        if(IsPlayerInRangeOfPoint(playerid,3.5,enterX,enterY,enterZ))
        {
               SetPlayerPos(playerid,exitX,exitY,exitZ);
        }
        if(IsPlayerInRangeOfPoint(playerid,3.5,exitX,exitY,exitZ))
        {
              SetPlayerPos(playerid,enterX,enterY,enterZ);
         }

}
Reply
#5

But, i just want to return_enter and return_exit. How should i go on to do exit command under the key?

pawn Код:
case KEY_CTRL_BACK:
    {
        return cmd_enter(playerid, "");
        }
                else return cmd_exit(playerid, "");
         }
        return 1;
    }
Something like that or i'm on wrong way?
Reply
#6

Use an array so you can toggle for each player whether they're in or out of the house.

When the variable is set to 0, call /enter command and set it to 1. Else (if it's 1), call the /exit command and set it to 0.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)