AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Why don't work vip ?? (https://forums.alliedmods.net/showthread.php?t=108267)

DoviuX 11-03-2009 13:13

Why don't work vip ??
 
PHP Code:

#include <amxmodx>

public plugin_init() 
{  
       
register_plugin("Bullet Damage","1.0","aZT")  
       
register_event("Damage""damage_msg""b""2!0""3=0""4!0")
       
register_cvar("bullet_damage","1")
       return 
PLUGIN_CONTINUE  
}

public 
Damage(idvIndexattacker)
{
    if (
get_user_flags(attacker) & ADMIN_LEVEL_B
    {
        new 
aIndex get_user_attacker(vIndex)
        new 
damage read_data(2)
        
set_hudmessage(0100200, -1.00.5520.14.00.020.027)
        
show_hudmessage(aIndex,"%i"damage)    
    }



unnyquee 11-03-2009 13:19

Re: Why don't work vip ??
 
You registered damage event with damage_msg forward and your actual forward's name is Damage. :)

DoviuX 11-03-2009 13:31

Re: Why don't work vip ??
 
but still not working maybe flag ?

unnyquee 11-03-2009 13:47

Re: Why don't work vip ??
 
PHP Code:

#include <amxmodx>

new g_Status;

public 
plugin_init()
{
      
register_plugin("Bullet Damage (Edit)""1.0""uNnyquEE");

      
register_event("Damage""eDamage");

      
g_Status register_cvar("bd_status""1");
}

public 
eDamage(index)
{
      if(!
get_pcvar_num(g_Status)) { return PLUGIN_CONTINUE; }

      new 
iaID get_user_attacker(index);
      
      if(
get_user_flags(iaID) & ADMIN_LEVEL_B)
      {
            new 
iDamage read_data(2);
                        
            
set_hudmessage(0100200, -1.00.5520.14.00.020.027);
            
show_hudmessage(iaID"%d"iDamage);
      }

      return 
PLUGIN_CONTINUE;


Hope it works!

Exolent[jNr] 11-03-2009 13:49

Re: Why don't work vip ??
 
@DoviuX

1. Hooked function is named wrong.

2. Damage event only passes the "victim" index into the function.
http://wiki.amxmodx.org/Half-Life_1_Game_Events#Damage

Code:
// Example public EventDamage( id ) {     new iDamage = read_data( 2 );     new iAttacker = get_user_attacker( id ); }


All times are GMT -4. The time now is 17:36.

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