Raised This Month: $51 Target: $400
 12% 

[HELP]Error in TakeDamage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Depresie
Veteran Member
Join Date: Nov 2013
Old 08-01-2015 , 19:47   [HELP]Error in TakeDamage
Reply With Quote #1

so im using this to increase the damage of the knife on my server
for some reason i always get in logs error native for the first parameter in the if statement
for example:

in this case i get native error get_user_weapon

Code:
if( get_user_weapon(attacker) == CSW_KNIFE && !zp_core_is_zombie(attacker))
in this case i get error native zp_core_is_zombie
Code:
if( !zp_core_is_zombie(attacker) && get_user_weapon(attacker) == CSW_KNIFE)
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <engine>
#include <hamsandwich>
#include <zp50_core>

#define PLUGIN "[ADN] Axe"
#define VERSION "1.0"
#define AUTHOR "ADN"

new cvar_human_axe_damage1cvar_human_axe_damage2

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
    
cvar_human_axe_damage1 register_cvar("zp_human_axe_damage1""100.0")
    
cvar_human_axe_damage2 register_cvar("zp_human_axe_damage2""400.0")
    
    
// Add your code here...
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    if( 
get_user_weapon(attacker) == CSW_KNIFE && !zp_core_is_zombie(attacker))
    {
        new 
button get_user_button(attacker)
        if((
button IN_ATTACK) && !(button IN_ATTACK2))
        {
            
SetHamParamFloat(4get_pcvar_float(cvar_human_axe_damage1))
        }
        if((
button IN_ATTACK2) && !(button IN_ATTACK))
        {
            
SetHamParamFloat(4get_pcvar_float(cvar_human_axe_damage2))
        }
    }

Depresie is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-01-2015 , 20:18   Re: [HELP]Error in TakeDamage
Reply With Quote #2

Check if attacker is a player.

PHP Code:
if( ( <= attacker <= MAX_PLAYERS ) && get_user_weapon(attacker) == CSW_KNIFE && !zp_core_is_zombie(attacker)) 
__________________

Last edited by Bugsy; 08-01-2015 at 20:18.
Bugsy is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 08-01-2015 , 20:51   Re: [HELP]Error in TakeDamage
Reply With Quote #3

mhmm, very interesting, never seen something like this before

i have a similar issue with the following case, so i could use and in this case that code?
Code:
client_putinserver(id)
{
        set_task(3.0, "info", id)
}

public info(id)
{
       if(cs_get_user_team(id) == UNNASIGNED)
       { 
              showhudmessage(id) blabla
               set_task(3.0, "info", id)
        }
}
Depresie is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-01-2015 , 21:00   Re: [HELP]Error in TakeDamage
Reply With Quote #4

If that player disconnected within 3 seconds you would get an error. You should always call remove_task() at client_disconnect() if you use set_task() on a player.
__________________
Bugsy is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 08-01-2015 , 21:36   Re: [HELP]Error in TakeDamage
Reply With Quote #5

okay thanks
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 03:08.


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