SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 26/04/2012, 01:24 PM   #1
Rudy_
High-roller
 
Rudy_'s Avatar
 
Join Date: Nov 2011
Location: Pakistan
Posts: 1,355
Reputation: 230
Default My Timer is not working +Rep+

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 :/
__________________
And now my Watch has Ended.


[Tutorial]
[TuT]How to create a car shooting Neon

[Filterscript]
Neon Vehicle Laser


__________________________________________________
Rudy_ is offline   Reply With Quote
Old 26/04/2012, 01:59 PM   #2
Rudy_
High-roller
 
Rudy_'s Avatar
 
Join Date: Nov 2011
Location: Pakistan
Posts: 1,355
Reputation: 230
Default Re: My Timer is not working +Rep+

Bump please i need help
__________________
And now my Watch has Ended.


[Tutorial]
[TuT]How to create a car shooting Neon

[Filterscript]
Neon Vehicle Laser


__________________________________________________
Rudy_ is offline   Reply With Quote
Old 26/04/2012, 02:05 PM   #3
SuperViper
High-roller
 
SuperViper's Avatar
 
Join Date: Sep 2011
Posts: 1,177
Reputation: 315
Default Re: My Timer is not working +Rep+

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;
}
SuperViper is offline   Reply With Quote
Old 26/04/2012, 02:11 PM   #4
Rudy_
High-roller
 
Rudy_'s Avatar
 
Join Date: Nov 2011
Location: Pakistan
Posts: 1,355
Reputation: 230
Default Re: My Timer is not working +Rep+

Still when i jump once velocity works ... but second time it don't jump high, i have to /jump again to activate it again.
__________________
And now my Watch has Ended.


[Tutorial]
[TuT]How to create a car shooting Neon

[Filterscript]
Neon Vehicle Laser


__________________________________________________
Rudy_ is offline   Reply With Quote
Old 26/04/2012, 02:17 PM   #5
ViniBorn
Godfather
 
ViniBorn's Avatar
 
Join Date: Aug 2010
Location: Brasília
Posts: 5,315
Reputation: 720
Default Re: My Timer is not working +Rep+

SetPlayerVelocity don't work with numbers bigger than 1
__________________



CONTATO: F A C E B O O K: @vinibornpawn

ViniBorn is offline   Reply With Quote
Old 26/04/2012, 02:19 PM   #6
Rudy_
High-roller
 
Rudy_'s Avatar
 
Join Date: Nov 2011
Location: Pakistan
Posts: 1,355
Reputation: 230
Default Re: My Timer is not working +Rep+

it don't makes the script "Not working" just even if it's 5 it will work like 1..
__________________
And now my Watch has Ended.


[Tutorial]
[TuT]How to create a car shooting Neon

[Filterscript]
Neon Vehicle Laser


__________________________________________________
Rudy_ is offline   Reply With Quote
Old 26/04/2012, 02:21 PM   #7
SuperViper
High-roller
 
SuperViper's Avatar
 
Join Date: Sep 2011
Posts: 1,177
Reputation: 315
Default Re: My Timer is not working +Rep+

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.
SuperViper is offline   Reply With Quote
Old 26/04/2012, 02:23 PM   #8
ViniBorn
Godfather
 
ViniBorn's Avatar
 
Join Date: Aug 2010
Location: Brasília
Posts: 5,315
Reputation: 720
Default Re: My Timer is not working +Rep+

You really need to use SuperJumpEnabled and IsJumping?

For your code, just one need exist
__________________



CONTATO: F A C E B O O K: @vinibornpawn

ViniBorn is offline   Reply With Quote
Old 26/04/2012, 02:30 PM   #9
Rudy_
High-roller
 
Rudy_'s Avatar
 
Join Date: Nov 2011
Location: Pakistan
Posts: 1,355
Reputation: 230
Default Re: My Timer is not working +Rep+

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.
__________________
And now my Watch has Ended.


[Tutorial]
[TuT]How to create a car shooting Neon

[Filterscript]
Neon Vehicle Laser


__________________________________________________
Rudy_ is offline   Reply With Quote
Old 26/04/2012, 02:36 PM   #10
SuperViper
High-roller
 
SuperViper's Avatar
 
Join Date: Sep 2011
Posts: 1,177
Reputation: 315
Default Re: My Timer is not working +Rep+

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

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Timer not working? +REP! Gooday Scripting Help 3 14/03/2012 04:21 PM
Timer Not Working acade Scripting Help 2 09/03/2012 08:24 AM
Timer dont working! Ricop522 Scripting Help 2 24/02/2012 05:40 PM
Timer Not working. Alex_Obando Help Archive 5 13/08/2011 03:15 AM
timer not working killdahobo99 Help Archive 3 31/07/2009 06:16 PM


All times are GMT. The time now is 03:02 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.