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

dasdasdadsa
Reply
#2

the function PRESSED must be placed in OnPlayerKeyStateChange not in a command.
Reply
#3

dsaasdsada
Reply
#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
#5

dsadasdadada
Reply
#6

Quote:
Originally Posted by Vytixz
Посмотреть сообщение
Can someone place this as a filterscript please? :/ I'm getting errors with my gamemode
Can you show ur gamemode, then we can place it.
Reply
#7

dsadasdadsa
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)