Raised This Month: $ Target: $400
 0% 

set/get_user_hp not working...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 12-10-2007 , 10:44   set/get_user_hp not working...
Reply With Quote #1

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 ->
Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 12-10-2007 , 10:51   Re: set/get_user_hp not working...
Reply With Quote #2

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)
purple_pixie is offline
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 12-10-2007 , 11:05   Re: set/get_user_hp not working...
Reply With Quote #3

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 -.-
Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 12-10-2007 , 11:11   Re: set/get_user_hp not working...
Reply With Quote #4

What exactly is that event you're calling it on?

Try using FakeMeta:

Code:
    set_pev(players[i],pev_health,200.0)
purple_pixie is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-10-2007 , 16:21   Re: set/get_user_hp not working...
Reply With Quote #5

Use filtered ResetHud event.
http://forums.alliedmods.net/showthread.php?t=42159
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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