My Timer is not working +Rep+
#1

I've tried everything to fix my SetTimeEx but it won't work... here's the timer.

pawn Code:
SetTimerEx("ResetJumping", 2500, true, "d" , playerid); // i got forward ResetJumping..
For what i'm using it is..

pawn Code:
IsJumping[MAX_PLAYERS];
and
pawn Code:
public ResetJumping(playerid)
{
    IsJumping[playerid] = 1;
    return 1;
}
Full code

pawn Code:
new
    SuperJumpEnabled[MAX_PLAYERS],
    Float:pX,
    Float:pY,
    Float:pZ,
    IsJumping[MAX_PLAYERS];

forward ResetJumping(playerid);
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(SuperJumpEnabled[playerid] == 1)
    {
        if(newkeys & KEY_JUMP && SuperJumpEnabled[playerid])
        {
            GetPlayerVelocity(playerid, pX, pY, pZ);
            SetPlayerVelocity(playerid, pX,pY, pZ+5);
            SendClientMessage(playerid, COLOR_USE, "Super Jump De-Acticated");
            SetTimerEx("ResetJumping", 2500, true, "d" , playerid);
        }
        return 1;
    }
    return 0;
}

public ResetJumping(playerid)
{
    IsJumping[playerid] = 1;
    return 1;
}
Command to enable/disable it.

pawn Code:
command(jump, playerid, params[])
{
    if(SuperJumpEnabled[playerid] == 0)
    {
        SuperJumpEnabled[playerid] = 1;
        SendClientMessage(playerid, COLOR_USE, "Super Jump is now enabled.");
        SetTimerEx("ResetJumping", 2500, true, "d" , playerid);
    }
    else
    {
        SuperJumpEnabled[playerid] = 0;
        SendClientMessage(playerid, COLOR_USE, "Super jump is now disabled.");
    }
    return 1;
}
No errors
Please someone help me :/
Reply
#2

Bump please i need help
Reply
#3

Stop re-posting this thread. Change your OnPlayerKeyStateChange whole function to this.

pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(SuperJumpEnabled[playerid] == 1)
    {
        if(newkeys & KEY_JUMP)
        {
            SuperJumpEnabled[playerid] = 0;
            GetPlayerVelocity(playerid, pX, pY, pZ);
            SetPlayerVelocity(playerid, pX,pY, pZ+5);
            SendClientMessage(playerid, COLOR_USE, "Super Jump De-Acticated");
            SetTimerEx("ResetJumping", 2500, false, "d" , playerid);
        }
        return 1;
    }
    return 0;
}
and change your timer function to

pawn Code:
public ResetJumping(playerid)
{
    IsJumping[playerid] = 1;
    SetTimerEx("ResetJumping", 2500, false, "d" , playerid);
    return 1;
}
Reply
#4

Still when i jump once velocity works ... but second time it don't jump high, i have to /jump again to activate it again.
Reply
#5

SetPlayerVelocity don't work with numbers bigger than 1
Reply
#6

it don't makes the script "Not working" just even if it's 5 it will work like 1..
Reply
#7

Change your timer to

pawn Code:
public ResetJumping(playerid)
{
    SuperJumpEnabled[playerid] = 1;
    SetTimerEx("ResetJumping", 2500, false, "d" , playerid);
    return 1;
}
Also, remove

pawn Code:
SetTimerEx("ResetJumping", 2500, true, "d" , playerid);
from your command.
Reply
#8

You really need to use SuperJumpEnabled and IsJumping?

For your code, just one need exist
Reply
#9

Hm... it works sometiems but still buggy..
1) when i tap Jump_Key it sometimes jumps twice or 3 times. and sometimes it dosen't. btw,The timer works now.
2) when i type /jump to activate it and then jump it works (fine) i made it like so i have to wait 60 secs to use it again, but players can use /jump so it'll be activated again and players can use jump again without waiting.
Reply
#10

Make it so they can't use /jump until the timer is finished.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)