10.10.2012, 19:03
Quote:
No, you're missing the point! You are confusing what "GetPlayerKeys" returns with what a player presses on their keyboard.
If I press "J", what does it do? You don't know and you can't detect it. However, if I press my "jump" key (which may or may not be "J") you CAN detect that. You can only see the EFFECTS of what the player told the game to do, not how they told the game to do it. Yes, crouch is "C" BY DEFAULT, but you can't assume it always will be. If someone has remapped their crouch key to "shift" and you say "press C to enter", then your code will fail - they will do as they are told, press C, and nothing will happen! Then they'll come and report a bug. What you should say is either "~k~~PED_DUCK~" or just "crouch". The first will look up what key THEY have mapped to crouch and report that, the second will just tell them to press whatever key they have duck mapped to (which they should know). This is why I said you can't have your "enter" function bound to "C", because there is NO WAY to detect when a user presses "C", because there is NO WAY to know which keys do what. |
Try this one and see that is teleporting you as ever you will try that will works.
Place a positions and see.
Try with, KEY_FIRE, KEY_JUMP, KEY_YES, KEY_NO, All of them will works !
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_CROUCH)
{
if(IsPlayerInSphere(playerid,0.0 ,0.0 , 0.0 ,1))//Change the positions
{
SetPlayerPos(playerid,0.0 ,0.0 , 0.0);//Player telepotring
return 1;
}
}
return 1;
}
But i really dont care about pepole will change thier buttons, i have explained him how to set it and that will works when he will click " C " if his buttons are restarted without changed.