[Help] JetPack (will +rep)
#1

Hello , please send me that code for disappearing the jetpack after 5 seconds after player press enter button or f button
Reply
#2

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.
Reply
#3

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)...
Reply
#4

But by using /jetpack and pressing F and again /jetpack and pressing F can spawn too many jetpacks
Reply
#5

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.
Reply
#6

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

HY ,
PHP код:
 SetTimerEx("Remove"5000false"i"playerid); 
The ABove line means it will disappear after 5 seconds ?
Reply
#8

HY, your code isn't working .
Reply
#9

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.
Reply
#10

The Jetpack Don't disappear after 5 seconds
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)