PDA

View Full Version : Removing Jetpack


Blackazur
19/04/2014, 06:43 PM
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_USE JETPACK);

Bingo
19/04/2014, 06:45 PM
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?

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_SECONDARY_ATTACK))
{
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
{
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NON E);
SendClientMessage(playerid, -1, "You're no longer using JETPACK.");
}
}
return 1;
}

Patrick
19/04/2014, 06:51 PM
setting the player action to none should remove the jetpack, and you could use OnPlayerKeyStateChange to detect if player has pressed enter with jetpack.


public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if( newkeys & KEY_SECONDARY_ATTACK && GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK ) return SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
return 1;
}