SA-MP Forums Archive
Removing Jetpack - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Removing Jetpack (/showthread.php?tid=507891)



Removing Jetpack - Blackazur - 19.04.2014

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);



Re: Removing Jetpack - Bingo - 19.04.2014

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;
}



Re: Removing Jetpack - Patrick - 19.04.2014

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;
}