OnPlayerKeyStateChange help -
Lops - 22.04.2014
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.
Re: OnPlayerKeyStateChange help -
Dignity - 22.04.2014
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?
Re: OnPlayerKeyStateChange help -
Lops - 22.04.2014
I haven't tested it yet, but yea, i'm using strcmp still.
Re: OnPlayerKeyStateChange help -
Galletziz - 22.04.2014
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);
}
}
Re: OnPlayerKeyStateChange help -
Lops - 23.04.2014
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?
Re: OnPlayerKeyStateChange help -
Konstantinos - 23.04.2014
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.