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

Bug Report Zclass Necro bug fix


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eNNkds
Member
Join Date: Sep 2012
Location: Romania
Old 07-01-2018 , 12:34   Zclass Necro bug fix
Reply With Quote #1

Quote:
L 07/01/2018 - 1903: [AMXX] Displaying debug trace (plugin "zp_zcls_necro.amxx")
L 07/01/2018 - 1903: [AMXX] Run time error 10: native error (native "zp_get_user_zombie_class")
L 07/01/2018 - 1903: [AMXX] [0] zp_zcls_necro.sma::zp_user_infected_post (line 177)
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <fun>
#include <zombieplague>

#define PLUGIN "[ZP] Class - Necro"
#define VERSION "1.1"
#define AUTHOR "HoRRoR"

#define message_begin_f(%1,%2,%3) (engfunc (EngFunc_MessageBegin, %1, %2, %3))
#define write_coord_f(%1) (engfunc (EngFunc_WriteCoord, %1))

new const zclass_name[] = { "Zombie Necro" }
new const 
zclass_info[] = { "Revive Zombies Press F1" }
new const 
zclass_model[] = { "zombie_source" }
new const 
zclass_clawmodel[] = { "v_knife_zombie.mdl" }
const 
zclass_health 3750
const zclass_speed 240
const Float:zclass_gravity 1.0
const Float:zclass_knockback 1.5

new g_zclass_necro
new g_necro_respawn[33] = 1
new g_cooldown[33] = 0
new g_maxplayers
new i_cooldown_time[33] = 0
new g_nowshowed[33] = 0

enum Coord_e 
{Float:xFloat:yFloat:z};

// --- config ------------------------ //
#define COLOR_R 0
#define COLOR_G 255
#define COLOR_B 255
new Float:g_resp_cooldown 60.0 //cooldown time
new g_must_infect_before_cast // set to 1, if you want, that zombie must infect someone to use spell. if 0 - zombie can cast if he spawn
new const sound_resurrection[] = "zombie_plague/spells/zombie_necro/Resurrection.wav" //respawn sound
new const sound_cast[] = "zombie_plague/spells/zombie_necro/Heal_Low_Base.wav" //cast sound
// ----------------------------------- //

public plugin_precache()
{
    
g_zclass_necro zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)
    
precache_sound(sound_resurrection)
    
precache_sound(sound_cast)
}

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("ability1""use_ability_one")
    
register_concmd("ability1""use_ability_one")
    
g_maxplayers get_maxplayers()
    
register_logevent("roundStart"2"1=Round_Start")
}

public 
roundStart()
{
    for (new 
1<= g_maxplayersi++)
    {
        
g_cooldown[i] = 0
        i_cooldown_time
[i] = floatround(g_resp_cooldown)

        
remove_task(i)
    }
}

public 
use_ability_one(id)
{
    if (
is_user_alive(id) && (zp_get_user_zombie_class(id) == g_zclass_necro) && zp_get_user_zombie(id) && !zp_get_user_nemesis(id) && (g_cooldown[id] == 0) && g_necro_respawn[id] == 0)
    {
        for (new 
1<= g_maxplayersi++)
        {
            if ((
is_user_alive(i) == 0) && zp_get_user_zombie(i) && !zp_get_user_nemesis(i) && (g_necro_respawn[id] == 0))
            {
                
zp_respawn_user(iZP_TEAM_ZOMBIE);
                
emit_sound(iCHAN_STREAMsound_resurrection1.0ATTN_NORM0PITCH_NORM);
                    
                static 
Coord_e:vecOrigin [Coord_e]; 
                
pev (i,pev_originvecOrigin); 

                
message_begin_f (MSG_PVSSVC_TEMPENTITYvecOrigin0); 
                
write_byte (TE_DLIGHT); 
                
write_coord_f (vecOrigin []); 
                
write_coord_f (vecOrigin []); 
                
write_coord_f (vecOrigin []); 
                
write_byte (50); //light redius
                
write_byte (COLOR_R); //red 
                
write_byte (COLOR_G); //green 
                
write_byte (COLOR_B); //blue 
                
write_byte (8);//life 
                
write_byte (90);//decay 
                
message_end();
            }
        }
        
        
g_necro_respawn[id] = 1
        
        emit_sound
(idCHAN_STREAMsound_cast1.0ATTN_NORM0PITCH_NORM);
        
        
i_cooldown_time[id] = floatround(g_resp_cooldown)
        
        
set_task(1.0"ShowHUD"id__"a",i_cooldown_time[id])
        
        
set_task(g_resp_cooldown,"necro_ability_cooldown",id)
        
        
g_cooldown[id] = 1
        
        g_nowshowed
[id] = 0
                    
    
}else if ((zp_get_user_zombie_class(id) == g_zclass_necro) && zp_get_user_zombie(id) && !zp_get_user_nemesis(id) && (g_cooldown[id] == 0) && (g_necro_respawn[id] == 1))
    {
        if (
is_user_alive(id))
        {
            new 
text[100]
            
format(text,99,"^x04[ZP]^x01 Your must infect someone to use your ability.")
            
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id
            
write_byte(id
            
write_string(text
            
message_end()
        }
    }
}
public 
necro_ability_cooldown(id)
{
    if ((
zp_get_user_zombie_class(id) == g_zclass_necro) && zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
    {
        
g_cooldown[id] = 0
        
new text[100]
        
format(text,99,"^x04[ZP]^x01 Your ability ^x04Resurrection^x01 is ready.")
        
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id
        
write_byte(id
        
write_string(text
        
message_end()
    }
}

public 
ShowHUD(id)
{
    if(
is_user_alive(id))
    {
        
i_cooldown_time[id] = i_cooldown_time[id] - 1;
        
set_hudmessage(20010000.750.9201.01.10.00.0, -1)
        
show_hudmessage(id"Resurrection cooldown: %d",i_cooldown_time[id])
    }else{
        
remove_task(id)
    }
}

public 
zp_user_humanized_post(id)
{
    
remove_task(id)
}

public 
zp_user_infected_post(idinfector)
{
    if ((
zp_get_user_zombie_class(id) == g_zclass_necro) && !zp_get_user_nemesis(id))
    {
        new 
text[100]
        new 
note_cooldown floatround(g_resp_cooldown)
        
format(text,99,"^x04[ZP]^x01 Your ability is ^x04Resurrection^x01. Cooldown:^x04 %d ^x01seconds.",note_cooldown)
        
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id
        
write_byte(id
        
write_string(text
        
message_end()
        
        
i_cooldown_time[id] = floatround(g_resp_cooldown)
        
remove_task(id)
        
        
g_necro_respawn[id] = g_must_infect_before_cast 
        
        g_cooldown
[id] = 0
        client_cmd
(id,"bind F1 ability1")
    }
    
    if (
zp_get_user_zombie_class(infector) == g_zclass_necro)
    {
        if (
g_nowshowed[infector] == 0)
        {
            
g_necro_respawn[infector] = 0
            
new text[100]
            
format(text,99,"^x04[ZP]^x01 Now you can use your ability.")
            
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},infector
            
write_byte(infector
            
write_string(text
            
message_end()
            
g_nowshowed[infector] = 1
        
}
    }

eNNkds is offline
Send a message via Skype™ to eNNkds
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 07-01-2018 , 15:25   Re: Zclass Necro bug fix
Reply With Quote #2

PHP Code:
public zp_user_infected_post(idinfector
    if (
zp_class_zombie_get_current(infector) == g_zclass_necro
    { 
        if (
g_nowshowed[infector] == 0
        { 
            
g_necro_respawn[infector] = 
            
new text[100
            
format(text,99,"^x04[ZP]^x01 Now you can use your ability."
            
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},infector)  
            
write_byte(infector)  
            
write_string(text)  
            
message_end() 
            
g_nowshowed[infector] = 
        

    } 

it is possible that if you are the first Zombie, it will throw the error since infector is 0 in that scenario
__________________
My plugin:
Celena Luna is offline
eNNkds
Member
Join Date: Sep 2012
Location: Romania
Old 07-01-2018 , 16:22   Re: Zclass Necro bug fix
Reply With Quote #3

i forgett to mention i use ZP 4.3 Fix5a if it helps
after i edit the line i gett errors

Last edited by eNNkds; 07-01-2018 at 16:30. Reason: forgett to add the error
eNNkds is offline
Send a message via Skype™ to eNNkds
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 07-03-2018 , 22:02   Re: Zclass Necro bug fix
Reply With Quote #4

PHP Code:
public zp_user_infected_post(idinfector)  
{
    if (
zp_get_user_zombie_class(infector) == g_zclass_necro)  
    {  
        if (
g_nowshowed[infector] == 0)  
        {  
            
g_necro_respawn[infector] = 0  
            
new text[100]  
            
format(text,99,"^x04[ZP]^x01 Now you can use your ability.")  
            
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},infector)   
            
write_byte(infector)   
            
write_string(text)   
            
message_end()  
            
g_nowshowed[infector] = 1  
        
}  
    }  

__________________
My plugin:
Celena Luna is offline
eNNkds
Member
Join Date: Sep 2012
Location: Romania
Old 07-08-2018 , 07:45   Re: Zclass Necro bug fix
Reply With Quote #5

it complied but i have 1 warning..

Code:
zp_zclass_necro.sma(176) : warning 203: symbol is never used: "g_must_infect_before_cast"
eNNkds is offline
Send a message via Skype™ to eNNkds
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 07-09-2018 , 18:27   Re: Zclass Necro bug fix
Reply With Quote #6

Quote:
Originally Posted by eNNkds View Post
it complied but i have 1 warning..

Code:
zp_zclass_necro.sma(176) : warning 203: symbol is never used: "g_must_infect_before_cast"
It won't effect the plugins. So don't worry
__________________
My plugin:
Celena Luna is offline
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 17:16.


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