AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help [ZP] Walljump (https://forums.alliedmods.net/showthread.php?t=84229)

The-Disaster 01-22-2009 17:06

Help [ZP] Walljump
 
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 :)

XxAvalanchexX 01-22-2009 23:36

Re: Help [ZP] Walljump
 
What is the problem that you are having?

The-Disaster 01-22-2009 23:46

Re: Help [ZP] Walljump
 
1 Attachment(s)
Here it is in the attachment .

XxAvalanchexX 01-23-2009 10:42

Re: Help [ZP] Walljump
 
The problem is that you are using this:

Code:
public client_PreThink(id,itemid)

The client_PreThink forward only has one parameter:

Code:
public client_PreThink(id)

I'm guessing itemid has something to do with the zombieplague include, which I don't know anything about.


All times are GMT -4. The time now is 01:42.

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