Key player
#1

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?
Reply
#2

Don't think it's possible, you could change his camera position to the back if that's what are you trying to do, or just call the OnPlayerKeyStateChange if you wanna trigger it.
Reply
#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
#4

That Function check if I press a key, not press for me.
Reply
#5

Quote:
Originally Posted by zeth98
Посмотреть сообщение
That Function check if I press a key, not press for me.
It looks like you did not know what you want.
The function keys used to verify who press it and not for another.
Reply
#6

I want to press that key for me. If I am in stunt plane and i put that funtion he need ti activate the red smoke. Something like this. I want to click for me.
Reply
#7

I dont get the point, for system to click 2. You can just send message of that.
Reply
#8

There is no possible way to script it nor there is a function which makes the buttons automatically pressed for the player.

Just like the above user's statement, Just send a message over the player. (E.G: "Press 2 to activate the red smoke from the Stunt Plane."
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)