Raised This Month: $52 Target: $400
 13% 

Bug Report L4D2 Hunter Zombie


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Andriis
Member
Join Date: May 2019
Old 05-14-2019 , 10:29   L4D2 Hunter Zombie
Reply With Quote #1

I am using the L4D2 Hunter Zombie on my server, which I found here.. But it's a little buggy .. I mean, when I choose the zm class and the next round comes I can use the L4D2's skill (Ctrl+E) while I'm a human. I tried to block it like I did with the Assassin zm, but it didn't worked, so I need a little help with it.. Thanks in advance
Here is the source file:
Code:
/*================================================================================

-----------------------------------
-*- [ZP] Hunter L4D -*-
-----------------------------------

~~~~~~~~~~~~~~~
- Description -
~~~~~~~~~~~~~~~

This zombie has long jumps as well as the popular game L4D2
Well, this time the skill is good and better,
to jump you have to press Ctrl + E and look where you want to jump.

================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

/*================================================================================
[Customizations]
=================================================================================*/

// Zombie Attributes
new const zclass_name[] = "L4D2 Hunter"
new const zclass_info[] = "High Long Jumps [Ctrl+E] "
new const zclass_model[] = "hunterv2_zp"
new const zclass_clawmodel[] = "v_knife_zombie_hunter.mdl"

const zclass_health = 6000
const zclass_speed = 290

const Float:zclass_gravity = 0.6
const Float:zclass_knockback = 0.1

new const leap_sound[4][] = { "left_4_dead2/hunter_jump.wav", "left_4_dead2/hunter_jump1.wav", "left_4_dead2/hunter_jump2.wav", "left_4_dead2/hunter_jump3.wav" }

/*================================================================================
Customization ends here!
Any edits will be your responsibility
=================================================================================*/

// Variables
new g_hunter

// Arrays
new Float:g_lastleaptime[33]

// Cvar pointers
new cvar_force, cvar_cooldown

// Plugin info.
#define PLUG_VERSION "0.2"
#define PLUG_AUTHOR "DJHD!"

/*================================================================================
[Init, CFG and Precache]
=================================================================================*/

public plugin_precache()
{
	// Register the new class and store ID for reference
	g_hunter = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
	
	// Sound
	static i
	for(i = 0; i < sizeof leap_sound; i++)
		precache_sound(leap_sound[i])
}

public plugin_init() 
{
	// Plugin Info
	register_plugin("[ZP] Zombie Class: Hunter L4D2 Zombie", PLUG_VERSION, PLUG_AUTHOR)
	
	// Forward
	register_forward(FM_PlayerPreThink, "fw_PlayerPreThink") 
	
	// Cvars
	cvar_force = register_cvar("zp_hunter_jump_force", "700") 
	cvar_cooldown = register_cvar("zp_hunter_jump_cooldown", "1.0")
	
	static szCvar[30]
	formatex(szCvar, charsmax(szCvar), "v%s by %s", PLUG_VERSION, PLUG_AUTHOR)
	register_cvar("zp_zclass_hunterl4d2", szCvar, FCVAR_SERVER|FCVAR_SPONLY)
}

/*================================================================================
[Zombie Plague Forwards]
=================================================================================*/

public zp_user_infected_post(id, infector)
{
	// It's the selected zombie class
	if(zp_get_user_zombie_class(id) == g_hunter)
	{
		if(zp_get_user_nemesis(id))
			return

		if(zp_get_user_assassin(id))
			return
		// Message
		client_print(id, print_chat, "thS | ^"CTRL+E^" to use ability")
	}
}

/*================================================================================
[Main Forwards]
=================================================================================*/

public fw_PlayerPreThink(id)
{
	if(!is_user_alive(id))
		return
		
	if(zp_get_user_nemesis(id))
		return
	
	if(zp_get_user_assassin(id))
		return

	if(is_user_connected(id))
	{
		if (allowed_hunterjump(id))
		{
			static Float:velocity[3]
			velocity_by_aim(id, get_pcvar_num(cvar_force), velocity)
			set_pev(id, pev_velocity, velocity)
			
			emit_sound(id, CHAN_STREAM, leap_sound[random_num(0, sizeof leap_sound -1)], 1.0, ATTN_NORM, 0, PITCH_HIGH)
			
			// Set the current super jump time
			g_lastleaptime[id] = get_gametime()
		}
	}
}

/*================================================================================
[Internal Functions]
=================================================================================*/

allowed_hunterjump(id)
{    
	if (!zp_get_user_zombie(id) && zp_get_user_nemesis(id) && zp_get_user_assassin(id))
		return false
	
	if (zp_get_user_zombie_class(id) != g_hunter)
		return false
	
	if (!((pev(id, pev_flags) & FL_ONGROUND) && (pev(id, pev_flags) & FL_DUCKING)))
		return false
	
	static buttons
	buttons = pev(id, pev_button)
	
	// Not doing a longjump (added bot support)
	if (!(buttons & IN_USE) && !is_user_bot(id))
		return false
	
	static Float:cooldown
	cooldown = get_pcvar_float(cvar_cooldown)
	
	if (get_gametime() - g_lastleaptime[id] < cooldown)
		return false
	
	return true
}
Andriis is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 05-15-2019 , 05:01   Re: L4D2 Hunter Zombie
Reply With Quote #2

PHP Code:
/*================================================================================

-----------------------------------
-*- [ZP] Hunter L4D -*-
-----------------------------------

~~~~~~~~~~~~~~~
- Description -
~~~~~~~~~~~~~~~

This zombie has long jumps as well as the popular game L4D2
Well, this time the skill is good and better,
to jump you have to press Ctrl + E and look where you want to jump.

================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

/*================================================================================
[Customizations]
=================================================================================*/

// Zombie Attributes
new const zclass_name[] = "L4D2 Hunter"
new const zclass_info[] = "High Long Jumps [Ctrl+E] "
new const zclass_model[] = "hunterv2_zp"
new const zclass_clawmodel[] = "v_knife_zombie_hunter.mdl"

const zclass_health 6000
const zclass_speed 290

const Float:zclass_gravity 0.6
const Float:zclass_knockback 0.1

new const leap_sound[4][] = { "left_4_dead2/hunter_jump.wav""left_4_dead2/hunter_jump1.wav""left_4_dead2/hunter_jump2.wav""left_4_dead2/hunter_jump3.wav" }

/*================================================================================
Customization ends here!
Any edits will be your responsibility
=================================================================================*/

// Variables
new g_hunter

// Arrays
new Float:g_lastleaptime[33]

// Cvar pointers
new cvar_forcecvar_cooldown

// Plugin info.
#define PLUG_VERSION "0.2"
#define PLUG_AUTHOR "DJHD!"

/*================================================================================
[Init, CFG and Precache]
=================================================================================*/

public plugin_precache()
{
    
// Register the new class and store ID for reference
    
g_hunter zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)
    
    
// Sound
    
static i
    
for(0sizeof leap_soundi++)
        
precache_sound(leap_sound[i])
}

public 
plugin_init() 
{
    
// Plugin Info
    
register_plugin("[ZP] Zombie Class: Hunter L4D2 Zombie"PLUG_VERSIONPLUG_AUTHOR)
    
    
// Forward
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink"
    
    
// Cvars
    
cvar_force register_cvar("zp_hunter_jump_force""700"
    
cvar_cooldown register_cvar("zp_hunter_jump_cooldown""1.0")
    
    static 
szCvar[30]
    
formatex(szCvarcharsmax(szCvar), "v%s by %s"PLUG_VERSIONPLUG_AUTHOR)
    
register_cvar("zp_zclass_hunterl4d2"szCvarFCVAR_SERVER|FCVAR_SPONLY)
}

/*================================================================================
[Zombie Plague Forwards]
=================================================================================*/

public zp_user_infected_post(idinfector)
{
    
// It's the selected zombie class
    
if(zp_get_user_zombie_class(id) == g_hunter)
    {
        if(
zp_get_user_nemesis(id))
            return

        if(
zp_get_user_assassin(id))
            return
        
// Message
        
client_print(idprint_chat"thS | ^"CTRL+E^" to use ability")
    }
}

/*================================================================================
[Main Forwards]
=================================================================================*/

public fw_PlayerPreThink(id)
{
    if(!
is_user_alive(id))
        return
        
    if(
zp_get_user_nemesis(id))
        return
    
    if(
zp_get_user_assassin(id))
        return

        if(!
zp_get_user_zombie(id))
                return

    if(
is_user_connected(id))
    {
        if(
allowed_hunterjump(id))
        {
            static 
Float:velocity[3]
            
velocity_by_aim(idget_pcvar_num(cvar_force), velocity)
            
set_pev(idpev_velocityvelocity)
            
            
emit_sound(idCHAN_STREAMleap_sound[random_num(0sizeof leap_sound -1)], 1.0ATTN_NORM0PITCH_HIGH)
            
            
// Set the current super jump time
            
g_lastleaptime[id] = get_gametime()
        }
    }
}

/*================================================================================
[Internal Functions]
=================================================================================*/

allowed_hunterjump(id)
{    
    if(!
zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_assassin(id))
        return 
    
    if(
zp_get_user_zombie_class(id) != g_hunter)
        return 
    
    if(!((
pev(idpev_flags) & FL_ONGROUND) && (pev(idpev_flags) & FL_DUCKING)))
        return 
    
    static 
buttons
    buttons 
pev(idpev_button)
    
    
// Not doing a longjump (added bot support)
    
if (!(buttons IN_USE) && !is_user_bot(id))
        return 
    
    static 
Float:cooldown
    cooldown 
get_pcvar_float(cvar_cooldown)
    
    if (
get_gametime() - g_lastleaptime[id] < cooldown)
        return     


I suppose you added this
PHP Code:
if (!zp_get_user_zombie(id) && zp_get_user_nemesis(id) && zp_get_user_assassin(id)) 
. In translation it means that the player must be human+nemesis+assasin that he could not use this skill. Problem is in
PHP Code:
&& 
because that means
PHP Code:
and 
. But,when we put
PHP Code:
|| 
instead
PHP Code:
&& 
then we get
PHP Code:
or 
. Now,if the player is human,or nemesis or assasin he will not be able to use this skill.
PHP Code:
if(!zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_assassin(id))
        return 
__________________
Check my new Zombie Mod (2019)
Based on best and fun half-life maps
Look at the video below

https://www.youtube.com/watch?v=bdvwxRujAl4&t=249s

Last edited by Krtola; 05-15-2019 at 05:14.
Krtola is offline
Send a message via Skype™ to Krtola
Andriis
Member
Join Date: May 2019
Old 05-15-2019 , 08:57   Re: L4D2 Hunter Zombie
Reply With Quote #3

Quote:
Originally Posted by Krtola View Post
PHP Code:
/*================================================================================

-----------------------------------
-*- [ZP] Hunter L4D -*-
-----------------------------------

~~~~~~~~~~~~~~~
- Description -
~~~~~~~~~~~~~~~

This zombie has long jumps as well as the popular game L4D2
Well, this time the skill is good and better,
to jump you have to press Ctrl + E and look where you want to jump.

================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

/*================================================================================
[Customizations]
=================================================================================*/

// Zombie Attributes
new const zclass_name[] = "L4D2 Hunter"
new const zclass_info[] = "High Long Jumps [Ctrl+E] "
new const zclass_model[] = "hunterv2_zp"
new const zclass_clawmodel[] = "v_knife_zombie_hunter.mdl"

const zclass_health 6000
const zclass_speed 290

const Float:zclass_gravity 0.6
const Float:zclass_knockback 0.1

new const leap_sound[4][] = { "left_4_dead2/hunter_jump.wav""left_4_dead2/hunter_jump1.wav""left_4_dead2/hunter_jump2.wav""left_4_dead2/hunter_jump3.wav" }

/*================================================================================
Customization ends here!
Any edits will be your responsibility
=================================================================================*/

// Variables
new g_hunter

// Arrays
new Float:g_lastleaptime[33]

// Cvar pointers
new cvar_forcecvar_cooldown

// Plugin info.
#define PLUG_VERSION "0.2"
#define PLUG_AUTHOR "DJHD!"

/*================================================================================
[Init, CFG and Precache]
=================================================================================*/

public plugin_precache()
{
    
// Register the new class and store ID for reference
    
g_hunter zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)
    
    
// Sound
    
static i
    
for(0sizeof leap_soundi++)
        
precache_sound(leap_sound[i])
}

public 
plugin_init() 
{
    
// Plugin Info
    
register_plugin("[ZP] Zombie Class: Hunter L4D2 Zombie"PLUG_VERSIONPLUG_AUTHOR)
    
    
// Forward
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink"
    
    
// Cvars
    
cvar_force register_cvar("zp_hunter_jump_force""700"
    
cvar_cooldown register_cvar("zp_hunter_jump_cooldown""1.0")
    
    static 
szCvar[30]
    
formatex(szCvarcharsmax(szCvar), "v%s by %s"PLUG_VERSIONPLUG_AUTHOR)
    
register_cvar("zp_zclass_hunterl4d2"szCvarFCVAR_SERVER|FCVAR_SPONLY)
}

/*================================================================================
[Zombie Plague Forwards]
=================================================================================*/

public zp_user_infected_post(idinfector)
{
    
// It's the selected zombie class
    
if(zp_get_user_zombie_class(id) == g_hunter)
    {
        if(
zp_get_user_nemesis(id))
            return

        if(
zp_get_user_assassin(id))
            return
        
// Message
        
client_print(idprint_chat"thS | ^"CTRL+E^" to use ability")
    }
}

/*================================================================================
[Main Forwards]
=================================================================================*/

public fw_PlayerPreThink(id)
{
    if(!
is_user_alive(id))
        return
        
    if(
zp_get_user_nemesis(id))
        return
    
    if(
zp_get_user_assassin(id))
        return

        if(!
zp_get_user_zombie(id))
                return

    if(
is_user_connected(id))
    {
        if(
allowed_hunterjump(id))
        {
            static 
Float:velocity[3]
            
velocity_by_aim(idget_pcvar_num(cvar_force), velocity)
            
set_pev(idpev_velocityvelocity)
            
            
emit_sound(idCHAN_STREAMleap_sound[random_num(0sizeof leap_sound -1)], 1.0ATTN_NORM0PITCH_HIGH)
            
            
// Set the current super jump time
            
g_lastleaptime[id] = get_gametime()
        }
    }
}

/*================================================================================
[Internal Functions]
=================================================================================*/

allowed_hunterjump(id)
{    
    if(!
zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_assassin(id))
        return 
    
    if(
zp_get_user_zombie_class(id) != g_hunter)
        return 
    
    if(!((
pev(idpev_flags) & FL_ONGROUND) && (pev(idpev_flags) & FL_DUCKING)))
        return 
    
    static 
buttons
    buttons 
pev(idpev_button)
    
    
// Not doing a longjump (added bot support)
    
if (!(buttons IN_USE) && !is_user_bot(id))
        return 
    
    static 
Float:cooldown
    cooldown 
get_pcvar_float(cvar_cooldown)
    
    if (
get_gametime() - g_lastleaptime[id] < cooldown)
        return     


I suppose you added this
PHP Code:
if (!zp_get_user_zombie(id) && zp_get_user_nemesis(id) && zp_get_user_assassin(id)) 
. In translation it means that the player must be human+nemesis+assasin that he could not use this skill. Problem is in
PHP Code:
&& 
because that means
PHP Code:
and 
. But,when we put
PHP Code:
|| 
instead
PHP Code:
&& 
then we get
PHP Code:
or 
. Now,if the player is human,or nemesis or assasin he will not be able to use this skill.
PHP Code:
if(!zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_assassin(id))
        return 
Thank you very much. It worked. I didn't thought about the !zp_get_user_zombie ..
Actually, the compiler compiles it with && and with || too, that wasn't a problem and I know the differences but thank you anyway, the problem was that I was able to use the ability when I was human ..soo.. Now it works correctly big thanks you! ^^
Andriis is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 05-15-2019 , 09:05   Re: L4D2 Hunter Zombie
Reply With Quote #4

Ok.
If there is another problem, report it here.
__________________
Check my new Zombie Mod (2019)
Based on best and fun half-life maps
Look at the video below

https://www.youtube.com/watch?v=bdvwxRujAl4&t=249s
Krtola is offline
Send a message via Skype™ to Krtola
Reply


Thread Tools
Display Modes

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 23:06.


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