Key player
#3

Quote:
Originally Posted by zeth98
Посмотреть сообщение
How can I make the player to press the key "2" (KEY_LOOK_BEHIND) I know to detect in onplayerkeystatechange.
But i want to make something like this
OnPlayerEnterCheckPoint(playerid)
{
if(CP[playerid] == 10)
{
PressKeyForPlayer(playerid,KEY_LOOK_BEHIND);
SendClientMessage(playerid,-1,"Key '2' was pressed for you");
}
return 1;
}
Is this possible?
PHP код:
/*
 * native IsPlayerKeyPress(playerid, keycode);
 */
stock IsPlayerKeyPress(playeridkeycode) {
    new 
keyupdownleftright;
    
GetPlayerKeys(playeridkeyupdownleftright);
    
//printf("PRESS player %d key %d updown %d leftright %d",playerid, key, updown, leftright);
    
if(key keycode) return true;
    else if(
keycode == KEY_UP && updown == -128 && leftright == 0) return true;
    else if(
keycode == KEY_DOWN && updown == 128 && leftright == 0) return true;
    else if(
keycode == KEY_LEFT && updown == && leftright == -128) return true;
    else if(
keycode == KEY_RIGHT && updown == && leftright == 128) return true;
    return 
false;
}
public 
OnPlayerEnterCheckPoint(playerid)
{
    if(
CP[playerid] == 10 && IsPlayerKeyPress(playeridKEY_LOOK_BEHIND))
    {
        
SendClientMessage(playerid,-1,"Key '2' was pressed for you");
        return 
1;
    }
    return 
1;

Reply


Messages In This Thread
Key player - by zeth98 - 28.08.2015, 19:34
Re: Key player - by xVIP3Rx - 28.08.2015, 19:41
Re: Key player - by Logofero - 28.08.2015, 19:50
Re: Key player - by zeth98 - 28.08.2015, 20:30
Re: Key player - by Logofero - 28.08.2015, 22:38
Re: Key player - by zeth98 - 29.08.2015, 08:18
Re: Key player - by CodeStyle175 - 29.08.2015, 08:36
Re: Key player - by JaKe Elite - 29.08.2015, 09:04

Forum Jump:


Users browsing this thread: 1 Guest(s)