Raised This Month: $32 Target: $400
 8% 

Suggestion / Subplugin Request [REQ] Multi Jump only for humans


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Depresie
Veteran Member
Join Date: Nov 2013
Old 07-30-2014 , 21:03   [REQ] Multi Jump only for humans
Reply With Quote #1

Can someone fix this? i tried to give double jump only to humans/surv/sniper ... but zombies have it too..

Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <zombie_plague_advance>
new jumpznum[33] = 0
new bool:dozjump[33] = false
new cvar_jumps
public plugin_init()
{
 register_plugin("[ZP] Sub-Plugin: Multi-Jump for Zombies", "1.0", "twistedeuphoria, Dabbi, B!gBud")
 cvar_jumps = register_cvar("zp_jump_count", "1")
}
public client_putinserver(id)
{
 jumpznum[id] = 0
 dozjump[id] = false
}
public client_disconnect(id)
{
 jumpznum[id] = 0
 dozjump[id] = false
}
public client_PreThink(id)
{
 if (!is_user_alive(id))
  return PLUGIN_CONTINUE
 
 if (!zp_get_user_zombie(id) || !zp_get_user_nemesis(id) || !zp_get_user_assassin(id))
{
 
 new nzbut = get_user_button(id)
 new ozbut = get_user_oldbutton(id)
 if((nzbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(ozbut & IN_JUMP))
 {
  if (jumpznum[id] < get_pcvar_num(cvar_jumps))
  {
   dozjump[id] = true
   jumpznum[id]++
   return PLUGIN_CONTINUE
  }
 }
 
 if((nzbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
 {
  jumpznum[id] = 0
  return PLUGIN_CONTINUE
 }
}
 return PLUGIN_CONTINUE
}
public client_PostThink(id)
{
 if (!is_user_alive(id))
  return PLUGIN_CONTINUE
 
 if (!zp_get_user_zombie(id) || !zp_get_user_nemesis(id) || !zp_get_user_assassin(id))
{
 
 if(dozjump[id] == true)
 {
  new Float:vezlocityz[3] 
  entity_get_vector(id,EV_VEC_velocity,vezlocityz)
  vezlocityz[2] = random_float(265.0,285.0)
  entity_set_vector(id,EV_VEC_velocity,vezlocityz)
  dozjump[id] = false
  return PLUGIN_CONTINUE
 }
}
 return PLUGIN_CONTINUE
}
Depresie is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 07-30-2014 , 21:40   Re: [REQ] Multi Jump only for humans
Reply With Quote #2

Just try this:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <zombieplague>

new jumpnum[33] = 0
new bool:dojump[33] = false
new cvar_jumps

public plugin_init()
{
    
register_plugin("[ZP] Sub-Plugin: Multi-Jump for Zombies""1.0""twistedeuphoria, Dabbi, B!gBud")
    
cvar_jumps register_cvar("zp_jump_count""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(zp_get_user_zombie(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))
    {
        if(
jumpnum[id] < get_pcvar_num(cvar_jumps))
        {
            
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(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

zmd94 is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 07-30-2014 , 22:21   Re: [REQ] Multi Jump only for humans
Reply With Quote #3

Don't use PreThink for multijump you just lag the server.
__________________
H.RED.ZONE is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 07-31-2014 , 01:40   Re: [REQ] Multi Jump only for humans
Reply With Quote #4

it works.. ty zmd
Depresie is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 07-31-2014 , 01:54   Re: [REQ] Multi Jump only for humans
Reply With Quote #5

Quote:
Originally Posted by Depresie View Post
it works.
You are welcome.

However, as H.RED.ZONE said PreThink can make the server lag. I will edit and optimize the code.

Last edited by zmd94; 07-31-2014 at 01:54.
zmd94 is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 07-31-2014 , 14:37   Re: [REQ] Multi Jump only for humans
Reply With Quote #6

that would be great ty vm
Depresie is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 07-31-2014 , 15:37   Re: [REQ] Multi Jump only for humans
Reply With Quote #7

I have edited the multi-jump plugin. Now, it is using Ham_Player_Jump:
Quote:
Multi-jump v2.0 (Addon + Extra Item)
The code do not use PreThink.

Credit:
Quote:
H.RED.ZONE for his RZ VIP Plugin.
zmd94 is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 07-31-2014 , 17:23   Re: [REQ] Multi Jump only for humans
Reply With Quote #8

man, you the best will test it later and tell you about it, right now i got something else to get done

LATER EDIT : works flawlessly thx again

Last edited by Depresie; 08-01-2014 at 02:19.
Depresie 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 07:07.


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