My Timer is not working +Rep+ -
Rudy_ - 26.04.2012
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..
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 :/
Re: My Timer is not working +Rep+ -
Rudy_ - 26.04.2012
Bump please i need help
Re: My Timer is not working +Rep+ -
SuperViper - 26.04.2012
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;
}
Re: My Timer is not working +Rep+ -
Rudy_ - 26.04.2012
Still when i jump once velocity works ... but second time it don't jump high, i have to /jump again to activate it again.
Re: My Timer is not working +Rep+ -
ViniBorn - 26.04.2012
SetPlayerVelocity don't work with numbers bigger than 1
Re: My Timer is not working +Rep+ -
Rudy_ - 26.04.2012
it don't makes the script "Not working" just even if it's 5 it will work like 1..
Re: My Timer is not working +Rep+ -
SuperViper - 26.04.2012
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.
Re: My Timer is not working +Rep+ -
ViniBorn - 26.04.2012
You really need to use SuperJumpEnabled and IsJumping?
For your code, just one need exist
Re: My Timer is not working +Rep+ -
Rudy_ - 26.04.2012
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.
Re: My Timer is not working +Rep+ -
SuperViper - 26.04.2012
Make it so they can't use /jump until the timer is finished.