Solved Multi Jump For Humans

Unpaid Requests, Public Plugins
Post Reply
Turnedo
Member
Member
Morocco
Posts: 15
Joined: 6 years ago
Contact:

Multi Jump For Humans

#1

Post by Turnedo » 6 years ago

Hi Escapers Zone DEV Team !
I need to change the multi jump from all to humans only !

Code: Select all

 #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","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
	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_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
}	
Thanks <3
Last edited by Raheem 6 years ago, edited 1 time in total.

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#2

Post by Raheem » 6 years ago

We have already Multi-Jump plugin better than this one. You can use it, It's here: http://escapers-zone.xyz/viewtopic.php?f=15&t=49

For humans only use:
  • Code: Select all

    #include <zombie_escape>
    
    // Variables
    new g_iJumpCount[33], bool:g_bGiveMultiJump[33]
    
    // Cvars
    new cvar_enable_multijump
    
    public plugin_init()
    {
    	register_plugin("[ZE] Multi-Jump", "1.1", "Raheem")
    	
    	// Hook Chains
    	RegisterHookChain(RG_CBasePlayer_Jump, "Fw_PlayerJump_Pre", 0)
    	
    	// Cvars
    	cvar_enable_multijump = register_cvar("ze_give_all_multijump", "0")
    }
    
    public plugin_natives()
    {
    	register_native("ze_give_user_multijump", "native_ze_give_user_multijump", 1)
    	register_native("ze_remove_user_multijump", "native_ze_remove_user_multijump", 1)
    }
    
    public Fw_PlayerJump_Pre(id)
    {
    	if (!is_user_alive(id))
    		return HC_SUPERCEDE
    	
    	new iFlags = get_entvar(id, var_flags)
    	
    	if (iFlags & FL_WATERJUMP || get_entvar(id, var_waterlevel) >= 2 || !(get_member(id, m_afButtonPressed) & IN_JUMP))
    		return HC_CONTINUE
    	
    	if (iFlags & FL_ONGROUND)
    	{
    		g_iJumpCount[id] = 0
    		return HC_CONTINUE
    	}
    	
    	if ((get_pcvar_num(cvar_enable_multijump) != 0 || g_bGiveMultiJump[id]) && !ze_is_user_zombie(id))
    	{
    		if (++g_iJumpCount[id] <= 1)
    		{
    			new Float:fVelocity[3]
    			get_entvar(id, var_velocity, fVelocity)
    			fVelocity[2] = 268.328157
    			set_entvar(id, var_velocity, fVelocity)
    			return HC_SUPERCEDE
    		}
    	}
    	return HC_CONTINUE
    }
    
    public ze_roundend()
    {
    	for(new i = 1; i <= get_member_game(m_nMaxPlayers); i++)
    	{
    		if(!is_user_connected(i))
    			continue
    		
    		g_bGiveMultiJump[i] = false
    	}
    }
    
    public native_ze_give_user_multijump(id)
    {
    	g_bGiveMultiJump[id] = true
    }
    
    public native_ze_remove_user_multijump(id)
    {
    	g_bGiveMultiJump[id] = false
    }
He who fails to plan is planning to fail

Turnedo
Member
Member
Morocco
Posts: 15
Joined: 6 years ago
Contact:

#3

Post by Turnedo » 6 years ago

Thanks Bro Raheem !
You are here <3 :)

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 4 guests