[Help] JetPack (will +rep) -
Arxalan - 31.12.2014
Hello , please send me that code for disappearing the jetpack after 5 seconds after player press enter button or f button
Re: [Help] JetPack (will +rep) -
CalvinC - 31.12.2014
Jetpacks aren't visible for other players when not equipped, so they cant use it, only the jetpack owner.
Also they disappear after a bit.
I don't know if that is possible though.
Re: [Help] JetPack (will +rep) -
Pasa - 31.12.2014
I think that is not possible, actually you don't need to do that because the jetpack is only visible for the player that has take down it (pressed enter - stoped the special animation)...
Re: [Help] JetPack (will +rep) -
Arxalan - 31.12.2014
But by using /jetpack and pressing F and again /jetpack and pressing F can spawn too many jetpacks
Re: [Help] JetPack (will +rep) -
CalvinC - 31.12.2014
Try this.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SECONDARY_ATTACK)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X, Y, Z);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
return 1;
}
}
Should remove jetpack when you press F.
Re: [Help] JetPack (will +rep) -
HY - 31.12.2014
pawn Код:
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_SECONDARY_ATTACK))
{
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
{
SetTimerEx("Remove", 5000, false, "i", playerid);
}
}
return 1;
}
forward Remove(playerid);
public Remove(playerid)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X, Y, Z+1);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
return 1;
}
CMD:jetpack(playerid, params[])
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
return 1;
}
Re: [Help] JetPack (will +rep) -
Arxalan - 31.12.2014
HY ,
PHP код:
SetTimerEx("Remove", 5000, false, "i", playerid);
The ABove line means it will disappear after 5 seconds ?
Re: [Help] JetPack (will +rep) -
Arxalan - 31.12.2014
HY, your code isn't working .
Re: [Help] JetPack (will +rep) -
CalvinC - 31.12.2014
Yes HY's code will set a timer that will make it disappear after 5 seconds.
pawn Код:
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_SECONDARY_ATTACK))
{
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X, Y, Z+1);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
}
}
return 1;
}
CMD:jetpack(playerid, params[])
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
return 1;
}
This is without timer if you don't want it.
Re: [Help] JetPack (will +rep) -
Arxalan - 31.12.2014
The Jetpack Don't disappear after 5 seconds