Raised This Month: $ Target: $400
 0% 

Help [ZP] Walljump


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
The-Disaster
Member
Join Date: Jul 2008
Old 01-22-2009 , 17:06   Help [ZP] Walljump
Reply With Quote #1

I have a problem with this and I couldn't fix it
please some one fix it to me and tell me what was wrong

because I'm learning to script

PHP Code:
#include <amxmodx>
#include <engine>
#include <zombieplague>

new const item_name[] = "Wall Jump!";
new 
g_itemid_walljump;

new 
bool:caughtJump[33]
new 
bool:doJump[33]
new 
Float:jumpVeloc[33][3]
new 
newButton[33]
new 
numJumps[33]
new 
wallteam

public plugin_init()
{
    
register_plugin("[ZP] Wall Jump","1.0","T[h]E Dis[as]teR")
    
g_itemid_walljump zp_register_extra_item(item_name5ZP_TEAM_HUMAN)
    
    
register_cvar("zp_walljump_str","300.0")
    
register_cvar("zp_walljump_num","3")
    
register_cvar("zp_walljump_team""0")
    
    
register_touch("player""worldspawn""Touch_World")
    
register_touch("player""func_wall""Touch_World")
    
register_touch("player""func_breakable""Touch_World")


public 
client_disconnect(id) {
    
caughtJump[id] = false
    doJump
[id] = false
    
for(new x=0;x<3;x++)
    
jumpVeloc[id][x] = 0.0
    newButton
[id] = 0
    numJumps
[id] = 0
}

public 
client_PreThink(id,itemid)
{
    if(!
is_user_alive(id))
    return 
PLUGIN_HANDLED;
    if(
itemid == g_itemid_walljump)
    {
        if(
zp_get_user_ammo_packs(id) < 5)
        {
            
client_print(idprint_chat,"[ZP] Not enough Ammopacks!");
            return 
PLUGIN_HANDLED;
        }
        else
            
wallteam get_cvar_num("walljump_team")
            new 
team get_user_team(id)
            if(
is_user_alive(id) && (!wallteam || wallteam == team)) 
            {
                
newButton[id] = get_user_button(id)
                new 
oldButton get_user_oldbutton(id)
                new 
flags get_entity_flags(id)
        
                if(
caughtJump[id] && (flags FL_ONGROUND)) 
                {
                    
numJumps[id] = 0
                    caughtJump
[id] = false
                
}
        
                if((
newButton[id] & IN_JUMP) && (flags FL_ONGROUND) && !caughtJump[id] && !(oldButton IN_JUMP) && !numJumps[id]) 
                {
                    
caughtJump[id] = true
                    entity_get_vector
(id,EV_VEC_velocity,jumpVeloc[id])
                    
jumpVeloc[id][2] = get_cvar_float("walljump_str")
                }
            }
        
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) - 5);
        
client_print(idprint_chat,"[ZP] You bought Wall Jump!");
        }
    }
}

public 
client_PostThink(id
{
    if(
is_user_alive(id)) 
    {
        if(
doJump[id]) 
        {
            
entity_set_vector(id,EV_VEC_velocity,jumpVeloc[id])
            
            
doJump[id] = false
            
            
if(numJumps[id] >= get_cvar_num("walljump_num"))
            {
                
numJumps[id] = 0
                caughtJump
[id] = false
            
}
        }
    }
}

public 
Touch_World(idworld
{
    if(
is_user_alive(id)) 
    {
        if(
caughtJump[id] && (newButton[id] & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND)) 
        {
            
            for(new 
x=0;x<2;x++)
                
jumpVeloc[id][x] *= -1.0
                
            numJumps
[id]++
            
doJump[id] = true
        
}    
    }

Thanks
__________________

Last edited by The-Disaster; 01-22-2009 at 17:15.
The-Disaster is offline
 



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 01:42.


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