Raised This Month: $ Target: $400
 0% 

[HELP] error fix


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
The Inhabitant Of Heavens
Member
Join Date: Aug 2011
Old 09-21-2011 , 15:14   [HELP] error fix
Reply With Quote #1

PHP Code:
L 09/21/2011 15:48:56Invalid weapon id 0
L 09
/21/2011 15:48:56: [AMXXDisplaying debug trace (plugin "zp_zclass_energy.amxx")
L 09/21/2011 15:48:56: [AMXXRun time error 10native error (native "get_weaponname")
L 09/21/2011 15:48:56: [AMXX]    [0zp_zclass_energy.sma::set_user_weapon_attack_time (line 648)
L 09/21/2011 15:48:56: [AMXX]    [1zp_zclass_energy.sma::fw_CmdStart (line 396

PHP Code:
    static weap_id
    weap_id 
get_user_weapon(id)
    
    if (
weap_id != CSW_KNIFE)
    {
        if (
make_energyball[id] || have_energyball[id])
        {
            
check_step[id] = 1
            step_started
[id] = false
            make_energyball
[id] = false
            have_energyball
[id] = false
            set_user_weapon_attack_time
(id0.0// Line 396
        
}
        
        return 
FMRES_IGNORED;
    } 
PHP Code:
set_user_weapon_attack_time(idFloat:next_attack_time)
{
    static 
weap_id
    weap_id 
get_user_weapon(id)
    
    static 
weap_name[32]
    
get_weaponname(weap_idweap_namecharsmax(weap_name)) // Line 648
    
    
static weap_ent
    weap_ent 
fm_find_ent_by_owner(-1weap_nameid)
    
    
set_weapon_next_pri_attack(weap_entnext_attack_time)
    
set_weapon_next_sec_attack(weap_entnext_attack_time)
    
    if (
weap_id == CSW_XM1014 || weap_id == CSW_M3)
        
set_weapon_idle_time(weap_entnext_attack_time)


Last edited by The Inhabitant Of Heavens; 09-21-2011 at 19:35.
The Inhabitant Of Heavens is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-21-2011 , 15:19   Re: [HELP] error fix
Reply With Quote #2

Well, obviously get_user_weapon() returns 0 for some reason, check if > 0 or post the entire function so we can see why it returns 0
__________________
Hunter-Digital is offline
The Inhabitant Of Heavens
Member
Join Date: Aug 2011
Old 09-21-2011 , 15:58   Re: [HELP] error fix
Reply With Quote #3

Hunter-Digital,help me


all function

PHP Code:
public fw_CmdStart(iduc_handleseed)
{
    if (!
is_user_alive(id) || !zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_zclass_energyball)
        return 
FMRES_IGNORED;
    
    if (
zp_get_user_nemesis(id))
        return 
FMRES_IGNORED;
        
    if (
zp_is_survivor_round())
        return 
FMRES_IGNORED;
    
    
#if defined FIRST_ZOMBIE_CANT_USE
    
if (zp_get_user_first_zombie(id))
        return 
FMRES_IGNORED;
    
#endif
    
    
static weap_id
    weap_id 
get_user_weapon(id)
    
    if (
weap_id != CSW_KNIFE)
    {
        if (
make_energyball[id] || have_energyball[id])
        {
            
check_step[id] = 1
            step_started
[id] = false
            make_energyball
[id] = false
            have_energyball
[id] = false
            set_user_weapon_attack_time
(id0.0)
        }
        
        return 
FMRES_IGNORED;
    }
    
    if (
get_pcvar_num(g_shoot_times) != && energyball_num[id] <= 0)
        return 
FMRES_IGNORED;
    
    if (
cooldown_started[id])
        return 
FMRES_IGNORED;
    
    static 
buttonoldbutton
    button 
get_uc(uc_handleUC_Buttons)
    
oldbutton pev(idpev_oldbuttons)
    
    
#if defined SUPPORT_BOT_TO_USE
    
if (is_user_bot(id))
    {
        static 
targetbody
        get_user_aiming
(idtargetbody)
        if (
check_target_valid(target))
        {
            
aim_target[id] = target
            
            aim_check_over_time
[id] = current_time 20.0
        
}
        else
        {
            
aim_target[id] = 0
            
            
if (current_time >= aim_check_over_time[id])
            {
                
check_step[id] = 1
                step_started
[id] = false
                
                
if (make_energyball[id] || have_energyball[id])
                {
                    
make_energyball[id] = false
                    have_energyball
[id] = false
                    set_user_weapon_attack_time
(id0.0)
                }
            }
        }
        
        switch (
check_step[id])
        {
            case 
1:
            {
                if (!
step_started[id])
                {

                    if (
aim_target[id])
                    {
                        
step_started[id] = true
                        step_check_time
[id] = current_time Hit_Attack2_Key_Time
                    
}
                }
                else
                {
                    if (
current_time >= step_check_time[id])
                    {
                        
check_step[id] = 2
                        step_started
[id] = false
                        make_energyball
[id] = true
                        set_user_weapon_attack_time
(id0.5)
                        
SendWeaponAnim(id0)
                    }
                }
            }
            case 
2:
            {
                if (!
step_started[id])
                {
                    
step_started[id] = true
                    step_check_time
[id] = current_time Make_EnergyBall_Time
                
}
                else
                {
                    if (
current_time >= step_check_time[id])
                    {
                        
check_step[id] = 3
                        step_started
[id] = false
                        make_energyball
[id] = false
                        have_energyball
[id] = true
                        set_user_weapon_attack_time
(id0.5)
                        
SendWeaponAnim(id0)
                    }
                }
            }
            case 
3:
            {
                if (
aim_target[id])
                {
                    if (
have_energyball[id])
                    {
                        
check_step[id] = 1
                        have_energyball
[id] = false
                        shoot_energyball
(id)
                        
set_user_weapon_attack_time(id0.0)
                    }
                }
            }
        }
        
        return 
FMRES_IGNORED;
    }
    
#endif
    
    
switch (check_step[id])
    {
        case 
1:
        {
            if (
button IN_ATTACK)
            {
                
check_step[id] = 1
                step_started
[id] = false
            
}
            else if (
button IN_ATTACK2)
            {
                if (!
step_started[id])
                {
                    if (!(
oldbutton IN_ATTACK2))
                    {
                        
step_started[id] = true
                        step_check_time
[id] = current_time Hit_Attack2_Key_Time
                    
}
                }
                else
                {
                    if (
current_time >= step_check_time[id])
                    {
                        if (
get_pcvar_num(g_shoot_times) != 0)
                            
//client_print(id, print_chat, "[SERVER] x3 1%d ", energyball_num[id])
                        
                        
check_step[id] = 2
                        step_started
[id] = false
                        make_energyball
[id] = true
                        set_user_weapon_attack_time
(id1.0)
                        
SendWeaponAnim(id0)
                    }
                }
            }
            else
            {
                
step_started[id] = false
            
}
        }
        case 
2:
        {
            if (
button IN_ATTACK)
            {
                
check_step[id] = 1
                step_started
[id] = false
                
                
if (make_energyball[id])
                {
                    
client_print(idprint_center"")
                    
make_energyball[id] = false
                    set_user_weapon_attack_time
(id0.0)
                }
            }
            else if (
button IN_ATTACK2)
            {
                
client_print(idprint_center"")
                
                if (!
step_started[id])
                {
                    
step_started[id] = true
                    step_check_time
[id] = current_time Make_EnergyBall_Time
                
}
                else
                {
                    if (
current_time >= step_check_time[id])
                    {
                        
check_step[id] = 3
                        step_started
[id] = false
                        make_energyball
[id] = false
                        have_energyball
[id] = true
                        set_user_weapon_attack_time
(id1.0)
                        
SendWeaponAnim(id0)
                    }
                }
            }
            else
            {
                
check_step[id] = 1
                step_started
[id] = false
                
                
if (make_energyball[id])
                {
                    
client_print(idprint_center"")
                    
make_energyball[id] = false
                    set_user_weapon_attack_time
(id0.0)
                }
            }
        }
        case 
3:
        {
            if (
button IN_ATTACK)
            {
                
check_step[id] = 1
                
                
if (have_energyball[id])
                {
                    
client_print(idprint_center"")
                    
have_energyball[id] = false
                    set_user_weapon_attack_time
(id0.0)
                }
            }
            else if (
button IN_ATTACK2)
            {
                static 
dist
                dist 
get_forward_view_dist(id)
                if (
dist Short_Dist_Cant_Shoot)
                    
client_print(idprint_center"%L",id,"TESLA_CLOSE")
                else
                    
client_print(idprint_center"%L",id,"TESLA_INFO2")
            }
            else
            {
                if (
have_energyball[id])
                {
                    
client_print(idprint_center"")
                    
check_step[id] = 1
                    have_energyball
[id] = false
                    shoot_energyball
(id)
                    
set_user_weapon_attack_time(id0.0)
                }
            }
        }
    }
    
    return 
FMRES_HANDLED;

The Inhabitant Of Heavens is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-21-2011 , 20:39   Re: [HELP] error fix
Reply With Quote #4

It seems "id" is valid, your players must be able to have no weapon in hand... so just check if weapon is not 0 first, add "weap_id > 0 && " to that "if(weap_id != CSW_KNIFE)"... and to that stock would be good aswell.
__________________
Hunter-Digital is offline
The Inhabitant Of Heavens
Member
Join Date: Aug 2011
Old 09-21-2011 , 23:35   Re: [HELP] error fix
Reply With Quote #5

if (weap_id != CSW_KNIFE)
-->
if ( weap_id > 0 && weap_id != CSW_KNIFE )

? o_O
The Inhabitant Of Heavens is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-21-2011 , 23:59   Re: [HELP] error fix
Reply With Quote #6

Yes, and to the stock aswell just to be sure.

Code:
set_user_weapon_attack_time(id, Float:next_attack_time) 
{ 
    static weap_id 
    weap_id = get_user_weapon(id) 
     
    if(weap_id <= 0)
       return

    //...
}
__________________
Hunter-Digital is offline
The Inhabitant Of Heavens
Member
Join Date: Aug 2011
Old 09-22-2011 , 06:27   Re: [HELP] error fix
Reply With Quote #7

Hunter-Digital,thank you very much!
The Inhabitant Of Heavens 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 19:34.


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