Raised This Month: $ Target: $400
 0% 

[ZP 4.3] MultiJump Only for Human and Surviour


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
steelzzz
Junior Member
Join Date: Sep 2013
Old 01-09-2014 , 08:55   [ZP 4.3] MultiJump Only for Human and Surviour
Reply With Quote #1

Hello. How make multijump only for human and surviour?
Code:
 #include <amxmodx>
#include <amxmisc>
#include <engine>
 
#define ADMINACCESS ADMIN_CHAT
 
new jumpnum[33] = 0
new bool:dojump[33] = false
 
public plugin_init()
{
    register_plugin("MultiJump","1.1","twistedeuphoria")
    register_cvar("amx_maxjumps","1")
    register_cvar("amx_mjadminonly","1")
}
 
public client_putinserver(id)
{
    jumpnum[id] = 0
    dojump[id] = false
}
 
public client_disconnect(id)
{
    jumpnum[id] = 0
    dojump[id] = false
}
 
public client_PreThink(id)
{
    if(!is_user_alive(id)) return PLUGIN_CONTINUE
    if(get_cvar_num("amx_mjadminonly") && (!access(id,ADMINACCESS))) return PLUGIN_CONTINUE
    new nbut = get_user_button(id)
    new obut = get_user_oldbutton(id)
    if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP) && (get_user_weapon(id) == CSW_KNIFE))
    {
        if(jumpnum[id] < get_cvar_num("amx_maxjumps"))
        {
            dojump[id] = true
            jumpnum[id]++
            return PLUGIN_CONTINUE
        }
    }
    if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
    {
        jumpnum[id] = 0
        return PLUGIN_CONTINUE
    }
    return PLUGIN_CONTINUE
}
 
public client_PostThink(id)
{
    if(!is_user_alive(id)) return PLUGIN_CONTINUE
    if(get_cvar_num("amx_mjadminonly") && (!access(id,ADMINACCESS))) return PLUGIN_CONTINUE
    if(dojump[id] == true)
    {
        new Float:velocity[3]    
        entity_get_vector(id,EV_VEC_velocity,velocity)
        velocity[2] = random_float(265.0,285.0)
        entity_set_vector(id,EV_VEC_velocity,velocity)
        dojump[id] = false
        return PLUGIN_CONTINUE
    }
    return PLUGIN_CONTINUE
}
steelzzz is offline
Torge
Veteran Member
Join Date: Oct 2011
Old 01-09-2014 , 09:49   Re: [ZP 4.3] MultiJump Only for Human and Surviour
Reply With Quote #2

Try this:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <zombieplague>
 
//#define ADMINACCESS ADMIN_CHAT
 
new jumpnum[33] = 0
new bool:dojump[33] = false
 
public plugin_init()
{
    
register_plugin("MultiJump","1.1","twistedeuphoria")
    
register_cvar("amx_maxjumps","2")
    
register_cvar("amx_mjadminonly","0")
}
 
public 
client_putinserver(id)
{
    
jumpnum[id] = 0
    dojump
[id] = false
}
 
public 
client_disconnect(id)
{
    
jumpnum[id] = 0
    dojump
[id] = false
}
 
public 
client_PreThink(id)
{
    if(!
is_user_alive(id)) return PLUGIN_CONTINUE
    
//if(get_cvar_num("amx_mjadminonly") && (!access(id,ADMINACCESS))) return PLUGIN_CONTINUE
    
if(!zp_get_user_zombie(id) || zp_get_user_survivor(id))
    {
        new 
nbut get_user_button(id)
        new 
obut get_user_oldbutton(id)
        if((
nbut IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut IN_JUMP) && (get_user_weapon(id) == CSW_KNIFE))
        {
            if(
jumpnum[id] < get_cvar_num("amx_maxjumps"))
            {
                
dojump[id] = true
                jumpnum
[id]++
                return 
PLUGIN_CONTINUE
            
}
        }
        if((
nbut IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
        {
            
jumpnum[id] = 0
            
return PLUGIN_CONTINUE
        
}
    }
    
    return 
PLUGIN_CONTINUE
}
 
public 
client_PostThink(id)
{
    if(!
is_user_alive(id)) return PLUGIN_CONTINUE
    
//if(get_cvar_num("amx_mjadminonly") && (!access(id,ADMINACCESS))) return PLUGIN_CONTINUE
    
    
if(!zp_get_user_zombie(id) || zp_get_user_survivor(id))
    {
        if(
dojump[id] == true)
        {
            new 
Float:velocity[3]    
            
entity_get_vector(id,EV_VEC_velocity,velocity)
            
velocity[2] = random_float(265.0,285.0)
            
entity_set_vector(id,EV_VEC_velocity,velocity)
            
dojump[id] = false
            
            
return PLUGIN_CONTINUE
        
}
    }
    
    return 
PLUGIN_CONTINUE

If loose indentation occurs, just ignore it.

Last edited by Torge; 01-10-2014 at 10:02.
Torge is offline
steelzzz
Junior Member
Join Date: Sep 2013
Old 01-09-2014 , 10:37   Re: [ZP 4.3] MultiJump Only for Human and Surviour
Reply With Quote #3

Quote:
Originally Posted by Torge View Post
Try this:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <zombieplague>
 
//#define ADMINACCESS ADMIN_CHAT
 
new jumpnum[33] = 0
new bool:dojump[33] = false
 
public plugin_init()
{
    
register_plugin("MultiJump","1.1","twistedeuphoria")
    
register_cvar("amx_maxjumps","2")
    
register_cvar("amx_mjadminonly","0")
}
 
public 
client_putinserver(id)
{
    
jumpnum[id] = 0
    dojump
[id] = false
}
 
public 
client_disconnect(id)
{
    
jumpnum[id] = 0
    dojump
[id] = false
}
 
public 
client_PreThink(id)
{
    if(!
is_user_alive(id)) return PLUGIN_CONTINUE
    
//if(get_cvar_num("amx_mjadminonly") && (!access(id,ADMINACCESS))) return PLUGIN_CONTINUE
    
if(!zp_get_user_survivor(id) || !zp_get_user_human(id) || zp_get_user_zombie(id) || zp_get_user_nemesis(id))
        return 
PLUGIN_CONTINUE;
    
    new 
nbut get_user_button(id)
    new 
obut get_user_oldbutton(id)
    if((
nbut IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut IN_JUMP) && (get_user_weapon(id) == CSW_KNIFE))
    {
        if(
jumpnum[id] < get_cvar_num("amx_maxjumps"))
        {
            
dojump[id] = true
            jumpnum
[id]++
            return 
PLUGIN_CONTINUE
        
}
    }
    if((
nbut IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
    {
        
jumpnum[id] = 0
        
return PLUGIN_CONTINUE
    
}
    return 
PLUGIN_CONTINUE
}
 
public 
client_PostThink(id)
{
    if(!
is_user_alive(id)) return PLUGIN_CONTINUE
    
//if(get_cvar_num("amx_mjadminonly") && (!access(id,ADMINACCESS))) return PLUGIN_CONTINUE
    
if(!zp_get_user_survivor(id) || !zp_get_user_human(id) || zp_get_user_zombie(id) || zp_get_user_nemesis(id))
        return 
PLUGIN_CONTINUE;
    
    if(
dojump[id] == true)
    {
        new 
Float:velocity[3]    
        
entity_get_vector(id,EV_VEC_velocity,velocity)
        
velocity[2] = random_float(265.0,285.0)
        
entity_set_vector(id,EV_VEC_velocity,velocity)
        
dojump[id] = false
        
return PLUGIN_CONTINUE
    
}
    return 
PLUGIN_CONTINUE
}

public 
zp_get_user_human(id)
{
    if(!
zp_get_user_zombie(id))
        return 
1;
        
    return 
0;

If loose indentation occurs, just ignore it.
Dont work

Last edited by steelzzz; 01-09-2014 at 10:54.
steelzzz is offline
Old 01-10-2014, 06:19
steelzzz
This message has been deleted by hornet. Reason: Do not bump your thread until 2 weeks have passed
Torge
Veteran Member
Join Date: Oct 2011
Old 01-10-2014 , 10:03   Re: [ZP 4.3] MultiJump Only for Human and Surviour
Reply With Quote #5

Post updated.

If that ain't work aswell then I'm probably too noobie to do that... xD
Torge is offline
steelzzz
Junior Member
Join Date: Sep 2013
Old 01-10-2014 , 11:35   Re: [ZP 4.3] MultiJump Only for Human and Surviour
Reply With Quote #6

Quote:
Originally Posted by Torge View Post
Post updated.

If that ain't work aswell then I'm probably too noobie to do that... xD
its work I love you <3
steelzzz is offline
tom05
Junior Member
Join Date: Jul 2013
Location: Czech Republic
Old 04-18-2014 , 17:43   Re: [ZP 4.3] MultiJump Only for Human and Surviour
Reply With Quote #7

Hello everyone, I would like to you to change this:

PHP Code:
 (get_user_weapon(id) == CSW_KNIFE)) 
to all weapon, because now I can use it only with knife

Thank you very much for your answers.
tom05 is offline
opssemnik
Junior Member
Join Date: Sep 2013
Old 04-18-2014 , 23:21   Re: [ZP 4.3] MultiJump Only for Human and Surviour
Reply With Quote #8

Quote:
Originally Posted by tom05 View Post
Hello everyone, I would like to you to change this:

PHP Code:
 (get_user_weapon(id) == CSW_KNIFE)) 
to all weapon, because now I can use it only with knife

Thank you very much for your answers.

remove this
&& (get_user_weapon(id) == CSW_KNIFE)

Last edited by opssemnik; 04-18-2014 at 23:22.
opssemnik is offline
tom05
Junior Member
Join Date: Jul 2013
Location: Czech Republic
Old 04-19-2014 , 06:54   Re: [ZP 4.3] MultiJump Only for Human and Surviour
Reply With Quote #9

Hello, the file is not compiled, please help me.
tom05 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 10:15.


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