AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Error Survivor Damage (https://forums.alliedmods.net/showthread.php?t=278222)

abood alnjjar 01-27-2016 13:14

[HELP] Error Survivor Damage
 
Hi Guys :)

i have Error compile this plugine plees help :)

PHP Code:

#include <amxmodx> 
#include <hamsandwich> 
#include <cs_ham_bots_api> 
#include <cstrike> 
#include <zombieplague>
#include <zp50_class_survivor> 
#include <zp50_grenade_frost>

new cvar_multiplier 

public plugin_init()  

    
register_plugin("[ZP] Survivor Damage Customizer""1.0""gogicaa"
     
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage_Post"1
    
RegisterHamBots(Ham_TakeDamage"fw_TakeDamage_Post"1
     
    
cvar_multiplier register_cvar("zp_survivor_damaga_multiplier""2.0"


public 
fw_TakeDamage_Post(victiminflictorattackerFloat:damagedamage_type

    if (
victim == attacker || !is_user_alive(attacker)) 
        return 
     
    if(
zp_class_survivor_get(attacker))
    
SetHamParamFloat (4damage get_pcvar_float(cvar_multiplier))
    
    
iDam[attacker] += damage get_pcvar_float(cvar_dmgmultiplier))

        if(
iDam[attacker] >= 2000)
}  
           
zp_grenade_frost_set(victim,true)
           
iDam[attacker] = 0
        
}
        
set_task(2.0"remove"victim)
}


public 
zp_fw_core_cure_post(id)
{
       if(
is_user_alive(id))
       {
           
iDam[id] = 0    
       
}
}

public 
zp_fw_core_infect_post(id)
{
       if(
is_user_alive(id))
       {
           
iDam[id] = 0    
       
}
}

public 
zp_fw_core_spawn_post(id)
{
       if(
is_user_alive(id))
       {
           
iDam[id] = 0    
       
}
}
       
public 
remove(id)
{
       if(
is_user_connected(id) && is_user_alive(id))
       {

       
zp_grenade_frost_set(idfalse)
       } 


redivcram 01-27-2016 15:50

Re: [HELP] Error Survivor Damage
 
Bummer :\
I wonder how it could be fixed... maybe post the error?

JoaoVieira 01-27-2016 17:30

Re: [HELP] Error Survivor Damage
 
Show us the Error or line...

Bugsy 01-27-2016 20:36

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:fDamMAX_PLAYERS ];

new 
cvar_multiplier 

public plugin_init()  

    
register_plugin"[ZP] Survivor Damage Customizer" "1.0" "gogicaa" 
    
    
RegisterHamHam_TakeDamage "player" "fw_TakeDamage_Post" true 
    
RegisterHamBotsHam_TakeDamage "fw_TakeDamage_Post" true 
    
    
cvar_multiplier register_cvar"zp_survivor_damaga_multiplier" "2.0" 


public 
fw_TakeDamage_Postvictim inflictor attacker Float:damage damage_type 

    if ( 
victim == attacker || !is_user_aliveattacker ) ) 
        return 
HAM_IGNORED
    
    
fDamattacker ] += damage get_pcvar_floatcvar_multiplier )
    
    if ( 
fDamattacker ] >= 2000.0 )
    { 
        
zp_grenade_frost_setvictim true )
        
fDamattacker ] = 0.0
        
        set_task
2.0 "remove" victim )
    }
    
    if( 
zp_class_survivor_get(attacker) )
    {
        
SetHamParamFloatdamage get_pcvar_floatcvar_multiplier ) )
        return 
HAM_HANDLED;
    }
    
    return 
HAM_IGNORED;


public 
client_disconnectid )
{
    
remove_taskid );
}

public 
zp_fw_core_cure_post(id)
{
    if(
is_user_alive(id))
    {
        
fDamid ] = 0.0    
    
}
}

public 
zp_fw_core_infect_post(id)
{
    if(
is_user_alive(id))
    {
        
fDamid ] = 0.0     
    
}
}

public 
zp_fw_core_spawn_post(id)
{
    if(
is_user_alive(id))
    {
        
fDamid ] = 0.0      
    
}
}
       
public 
removeid )
{
    if( 
is_user_aliveid ) )
    {
        
zp_grenade_frost_setid false )
    }



abood alnjjar 01-28-2016 09:45

Re: [HELP] Error Survivor Damage
 
thx is work :D


All times are GMT -4. The time now is 09:22.

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