Re: [HELP] Error Survivor Damage
I found the below issues that were giving compile errors. I fixed these things to make it compile without errors or warnings, but I did not check anything beyond that so I'm not sure if it works or not, that's your job. The bottom 2 bullets were not preventing compile but I added. - You were using the iDam[] variable without defining it. Since this holds a float, I renamed it to fDam[].
- You were using the cvar_multiplier variable named incorrectly (cvar_dmgmultiplier) in takedamage.
- Your opening/closing brackets were wrong.
- Removed is_user_connected() check in remove() function because a connected check is done when you check is_user_alive().
- Added remove_task() at client_disconnect().
PHP Code:
#include <amxmodx> #include <hamsandwich> #include <cs_ham_bots_api> #include <cstrike> #include <zombieplague> #include <zp50_class_survivor> #include <zp50_grenade_frost>
#define MAX_PLAYERS 32
new Float:fDam[ MAX_PLAYERS + 1 ];
new cvar_multiplier
public plugin_init() { register_plugin( "[ZP] Survivor Damage Customizer" , "1.0" , "gogicaa" ) RegisterHam( Ham_TakeDamage , "player" , "fw_TakeDamage_Post" , true ) RegisterHamBots( Ham_TakeDamage , "fw_TakeDamage_Post" , true ) cvar_multiplier = register_cvar( "zp_survivor_damaga_multiplier" , "2.0" ) }
public fw_TakeDamage_Post( victim , inflictor , attacker , Float:damage , damage_type ) { if ( victim == attacker || !is_user_alive( attacker ) ) return HAM_IGNORED; fDam[ attacker ] += damage * get_pcvar_float( cvar_multiplier ) if ( fDam[ attacker ] >= 2000.0 ) { zp_grenade_frost_set( victim , true ) fDam[ attacker ] = 0.0 set_task( 2.0 , "remove" , victim ) } if( zp_class_survivor_get(attacker) ) { SetHamParamFloat( 4 , damage * get_pcvar_float( cvar_multiplier ) ) return HAM_HANDLED; } return HAM_IGNORED; }
public client_disconnect( id ) { remove_task( id ); }
public zp_fw_core_cure_post(id) { if(is_user_alive(id)) { fDam[ id ] = 0.0 } }
public zp_fw_core_infect_post(id) { if(is_user_alive(id)) { fDam[ id ] = 0.0 } }
public zp_fw_core_spawn_post(id) { if(is_user_alive(id)) { fDam[ id ] = 0.0 } } public remove( id ) { if( is_user_alive( id ) ) { zp_grenade_frost_set( id , false ) } }
|