Raised This Month: $ Target: $400
 0% 

set_task problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 04-06-2009 , 15:29   set_task problem
Reply With Quote #1

PHP Code:
#include <amxmodx> // set_task(0.1, "Hns_Multijump", 0,  1, "ab", 1) // Cant find a place for it
#include <fakemeta>
 
#define FLAG_ADMIN ADMIN_LEVEL_A
 
new g_iJumpCount[33], bool:g_bJumped[33];
new 
g_pMaxJumpsg_pAdminOnly;
new 
bool:moving[512] = true
public plugin_init()
{
        
register_plugin("hns_MultiJump""0.1""TitANious (port to FM by hleV)");
        
g_pMaxJumps register_cvar("mj_maxjumps""1"); // 1 normal jump + amount in CVAR
        
g_pAdminOnly register_cvar("mj_adminonly""0");
        
register_forward(FM_PlayerPreThink"fwPreThink");
        
register_forward(FM_PlayerPostThink"fwPostThink");
        
register_logevent("fwPreThink"2"1=Round_Start"
}
 
public 
client_disconnect(id)
{
        
g_iJumpCount[id] = 0;
        
g_bJumped[id] = false;
}
 
public 
fwPreThink(id)

        if (!
is_user_alive(id) || (get_pcvar_num(g_pAdminOnly) && !(get_user_flags(id) & FLAG_ADMIN)))
                return; 
// forgot a ) at the if()
 
        
static iButtoniOldButtoniFlags// the code above wasn't aligned properly, should work now...
        
iButton pev(idpev_button); 
        
iOldButton pev(idpev_oldbuttons); 
        
iFlags pev(idpev_flags); 
 
        if ((
iButton IN_JUMP) && !(iFlags FL_ONGROUND) && !(iOldButton IN_JUMP)) 
                if (
g_iJumpCount[id] < get_pcvar_num(g_pMaxJumps)) 
                { 
                        
g_iJumpCount[id]++; 
                        
g_bJumped[id] = true
                        return; 
                } 
 
        if ((
iButton IN_JUMP) && (iFlags FL_ONGROUND)) 
                
g_iJumpCount[id] = 0;
        
set_task(0.1,"reset",id,"",0,"ab"1)  // SET TASKKKK
}
public 
fwPostThink(id)
{
        if (!
is_user_alive(id) || (get_pcvar_num(g_pAdminOnly) && !(get_user_flags(id) & FLAG_ADMIN)))
                return;
 
        if (
g_bJumped[id])
        {
                static 
Float:fVel[3];
                
pev(idpev_velocityfVel);
                
fVel[2] = random_float(265.0285.0); // IMO it should be lesser
                
set_pev(idpev_velocityfVel);
                
g_bJumped[id] = false;
        }
    
    
set_task(0.1,"reset",id,"",0,"ab"1)  // SET TASKKKK
}
public 
reset(id)
{
        
moving[id] = false;

Code:
Should only be used once each round
PHP Code:
set_task(0.1,"reset",id,"",0,"ab"1
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-06-2009 , 15:47   Re: set_task problem
Reply With Quote #2

Use this (I think):

PHP Code:
register_event("HLTV""reset_jumps""a""1=0""2=0"


And get rid of those set_tasks. PreThink and PostThink are executed on every server frame!
__________________

Last edited by fysiks; 04-06-2009 at 16:13.
fysiks is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 04-06-2009 , 15:50   Re: set_task problem
Reply With Quote #3

Code:
Warning: Symbol is never used: "moving" on line 66
Its the } at last
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-06-2009 , 15:56   Re: set_task problem
Reply With Quote #4

Use the register_event I updated in my code above (instead of logevent).
__________________
fysiks is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 04-06-2009 , 15:59   Re: set_task problem
Reply With Quote #5

Same problem (Error)
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-06-2009 , 16:09   Re: set_task problem
Reply With Quote #6

Sorry, I didn't read the code right.

What in the world is the variable "moving" from your previously posted code?
__________________

Last edited by fysiks; 04-06-2009 at 16:12.
fysiks is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 04-06-2009 , 16:09   Re: set_task problem
Reply With Quote #7

set_task(0.1,"reset",id) Der er helt fint ;)
__________________
Dr.G is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 02:24.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode