AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Health display admins only. (https://forums.alliedmods.net/showthread.php?t=185163)

poliisi299 05-13-2012 12:56

Health display admins only.
 
how i can to do admins only can see other players HP ??

here is the plugin i already added ADMIN_LEVEL ADMIN_CHAT but dont work, other can see HP
PHP Code:

#include <amxmodx>
 
#define ADMIN_LEVEL ADMIN_CHAT
 
public plugin_init() {
    
register_plugin("HP On Damage""1.0""poliisi299...")
    
register_event("Damage","event_damage","b","2!0","3=0","4!0")
}
 
public 
event_damage(id)
{
    new 
killer get_user_attacker(id)
    if(
is_user_connected(killer) && is_user_alive(id)) client_print(killer,print_center,"Health: %i",get_user_health(id))
     return 
PLUGIN_HANDLED



<VeCo> 05-13-2012 13:08

Re: Health display admins only.
 
Include amxmisc and change the check like this:

PHP Code:

if(is_user_connected(killer) && is_user_alive(id)) 

->

PHP Code:

if(is_user_connected(killer) && is_user_alive(id) && (get_user_flags(killer) & ADMIN_LEVEL)) 


poliisi299 05-13-2012 13:40

Re: Health display admins only.
 
Thank you, i think about this :D, do you know how can set the "Health: %i" show in HUD ??

<VeCo> 05-13-2012 13:45

Re: Health display admins only.
 
PHP Code:

#include <amxmodx>
 
#define ADMIN_LEVEL ADMIN_CHAT
 
 
new g_synchud
public plugin_init() {
    
register_plugin("HP On Damage""1.0""<VeCo>")
    
register_event("Damage","event_damage","b","2!0","3=0","4!0")
    
    
g_synchud CreateHudSyncObj()
}
 
public 
event_damage(id)
{
    static 
i_killer
    i_killer 
get_user_attacker(id)
    
    if(
is_user_connected(i_killer) && (get_user_flags(i_killer) & ADMIN_LEVEL) && is_user_alive(id))
    {
 
set_hudmessage(25500, -1.0, -1.0,  .holdtime 1.0)
 
ShowSyncHudMsg(i_killer,g_synchud"Health: %i",get_user_health(id))
    }



poliisi299 05-13-2012 13:53

Re: Health display admins only.
 
thank you so much (:


All times are GMT -4. The time now is 00:23.

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