What's wrong with this simple script? (MegaJump)
#4

No that's not how it works.
You need a var. Set it to 1.
If 0, Then megajump from OnPlayerKeyStateChange will be blocked.
But when it's 1. Then it will be worked. Simple eh?

pawn Код:
new MegaJump[MAX_PLAYERS]; //at the top of the script

#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

public OnPlayerConnect(playerid)
{
    MegaJump[playerid] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    MegaJump[playerid] = 0;
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(MegaJump[playerid] == 1)
    {
        if(PRESSED(KEY_JUMP))
        {
            new Float:P[3];
            GetPlayerPos(playerid,P[0],P[1],P[2]);
            GetPlayerVelocity(playerid,P[0],P[1],P[2]);
            SetPlayerVelocity(playerid,P[0],P[1],P[2]+5.0);
        }
    }
    return 1;
}

CMD:megajump(playerid, params[])
{
    if(MegaJump[playerid] == 0)
    {
        //Messages, Sound etc...
        MegaJump[playerid] = 1;
    }
    else if(MegaJump[playerid] == 1)
    {
        //Messages, Sound etc...
        MegaJump[playerid] = 0;
    }
    return 1;
}
Reply


Messages In This Thread
What's wrong with this simple script? (MegaJump) - by Vytixz - 17.03.2013, 01:33
Re: What's wrong with this simple script? (MegaJump) - by JaKe Elite - 17.03.2013, 01:48
Re: What's wrong with this simple script? (MegaJump) - by Vytixz - 17.03.2013, 01:50
Re: What's wrong with this simple script? (MegaJump) - by JaKe Elite - 17.03.2013, 01:55
Re: What's wrong with this simple script? (MegaJump) - by Vytixz - 17.03.2013, 03:08
Re: What's wrong with this simple script? (MegaJump) - by Gamer_007 - 17.03.2013, 03:11
Re: What's wrong with this simple script? (MegaJump) - by Vytixz - 17.03.2013, 03:20

Forum Jump:


Users browsing this thread: 2 Guest(s)