Removing Jetpack
#1

Hello, i have a command to spawn a jetpack like that, but how can i make that when i press enter that the jetpack is automatically removed?

Код:
      SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
Reply
#2

Actually it is removed, It is visible only in your screen.

#Maybe, Just give a try in my old server same thing, Only playerid(me) can see jetpack where as when i said one of my player to take jetpack he couldn't.

Lets test maybe we can?

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SECONDARY_ATTACK))
    {
        if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
        {
                SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
                SendClientMessage(playerid, -1, "You're no longer using JETPACK.");
        }
    }
    return 1;
}
Reply
#3

setting the player action to none should remove the jetpack, and you could use OnPlayerKeyStateChange to detect if player has pressed enter with jetpack.

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if( newkeys & KEY_SECONDARY_ATTACK && GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK ) return SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)