AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   set/get_user_hp not working... (https://forums.alliedmods.net/showthread.php?t=64193)

Sn!ff3r 12-10-2007 10:44

set/get_user_hp not working...
 
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Sn!ff3r"

#define HP 900

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("HLTV""daj_hp""a""1=0""2=0")
}

public 
daj_hp()
{
    new 
players get_playersnum()
    for (new 
1<= playersi++)
    {
        
set_user_health(iHP)
        
client_print(0,print_chat,"Player with UID %d have %d HP",iget_user_health(i))
    }


Why this doesn't work? Look on screen -> http://www.bankfotek.pl/thumb/22322.jpeg

purple_pixie 12-10-2007 10:51

Re: set/get_user_hp not working...
 
It can't display >250.

You have 900 HP, can should be able to take 899 damage and survive.

EDIT: And looping through players like that is a bad idea.

You should do:

Code:
     new players[32],count ;     get_players(players,count)     for (new i = 1; i <= count ; i++)     {         set_user_health(players[i], HP)

Sn!ff3r 12-10-2007 11:05

Re: set/get_user_hp not working...
 
Quote:

It can't display >250.
with 102 hp also doesnt work :/

Quote:

You have 900 HP, can should be able to take 899 damage and survive.
no... 100hp, one hegren can kill me

PHP Code:

#include <amxmodx>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Sn!ff3r"

#define HP 249

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("HLTV""daj_hp""a""1=0""2=0")
}

public 
daj_hp()
{
    
/*new players = get_playersnum()
    for (new i = 1; i <= players; i++)
    {
        set_user_health(i, HP)
        client_print(0,print_chat,"Player with UID %d have %d HP",i, get_user_health(i))
    }*/
    
    
new players[32],count
    get_players
(players,count)
    for (new 
1<= count i++)
    {    
    
set_user_health(players[i], HP)
    }


Doesn't work -.-

purple_pixie 12-10-2007 11:11

Re: set/get_user_hp not working...
 
What exactly is that event you're calling it on?

Try using FakeMeta:

Code:
    set_pev(players[i],pev_health,200.0)

ConnorMcLeod 12-10-2007 16:21

Re: set/get_user_hp not working...
 
Use filtered ResetHud event.
http://forums.alliedmods.net/showthread.php?t=42159


All times are GMT -4. The time now is 11:07.

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