Raised This Month: $ Target: $400
 0% 

How to show HP when you get more.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-17-2009 , 15:37   How to show HP when you get more.
Reply With Quote #1

Hello, how to show msg/hud when your hp get more, for example when used healer or something else, not when damage. thanks
__________________
xPaw is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-17-2009 , 15:38   Re: How to show HP when you get more.
Reply With Quote #2

Hook "Health" event, and check difference from the event's value from the old event's value.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-17-2009 , 16:16   Re: How to show HP when you get more.
Reply With Quote #3

i'm hooked that event, but i cant understand howto do it
__________________
xPaw is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 01-17-2009 , 17:17   Re: How to show HP when you get more.
Reply With Quote #4

Code:
#include <amxmodx>   new g_iHealth[33] = 100; // I hope you start with 100 health ^^   public plugin_init()         register_event("Health", "eHealth", "be", "1>0");   public eHealth(iCl) {         static iNewHealth; iNewHealth = get_user_health(iCl);         static iGainedHealth = iNewHealth - g_iHealth[iCl];           if (iGainedHealth)         {                 set_hudmessage(255, 255, 255, -1.0, 0.9, 0.1, 0.1, 2.0);                 show_hudmessage(iCl, "Gained health: %d", iGainedHealth);         }           g_iHealth[iCl] = iNewHealth; }
__________________

Last edited by hleV; 01-17-2009 at 17:23.
hleV is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-18-2009 , 08:55   Re: How to show HP when you get more.
Reply With Quote #5

@hleV: I don't think you can create an array like that.
You must set what cell have what value:
Code:
// Creates an array and assigns 100 to every cell. new g_iHealth[33] = {100, ...};
Corrections are more than welcomed.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-18-2009 , 10:44   Re: How to show HP when you get more.
Reply With Quote #6

Quote:
Originally Posted by Dores View Post
@hleV: I don't think you can create an array like that.
You must set what cell have what value:

Code:
</p><p>// Creates an array and assigns 100 to every cell.</p><p>new g_iHealth[33] = {100, ...};


Corrections are more than welcomed.
True. Ofc easier is just make a loop, if there should be same value in every cell.
SnoW is offline
Send a message via MSN to SnoW
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 03-02-2009 , 15:20   Re: How to show HP when you get more.
Reply With Quote #7

Quote:
Originally Posted by SnoW View Post
True. Ofc easier is just make a loop, if there should be same value in every cell.
Sorry for posting, but i think you're wrong. A loop will just make things slower, {} is faster
__________________

anakin_cstrike is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 03-03-2009 , 07:03   Re: How to show HP when you get more.
Reply With Quote #8

Quote:
Originally Posted by anakin_cstrike View Post
Sorry for posting, but i think you're wrong. A loop will just make things slower, {} is faster
Sorry for saying, but I think it's not necessary to give me -karma for over month old post, when you haven't even understood what I've meant.
Quote:
Originally Posted by SnoW View Post
True. Ofc easier is just make a loop, if there should be same value in every cell.
I have never talked anything about how fast it would be.
Quote:
Originally Posted by Dores View Post
@hleV: I don't think you can create an array like that.
You must set what cell have what value:

Code:
</p><p>// Creates an array and assigns 100 to every cell.</p><p>new g_iHealth[33] = {100, ...};


Corrections are more than welcomed.
Okay, In this case it could be coded like this:
Code:
new g_iHealth[33] = {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100};
33 values ye. But you can imagine what it would be if I would have for example an array g_Playervalues[12][33]. The code's size would grow up pretty nicely. At least I wouldn't bother doing every array like that, though I've never had need to change the value in every cell like that.
Just say if you don't understand the purpose using loop here.

Last edited by SnoW; 03-03-2009 at 07:07.
SnoW is offline
Send a message via MSN to SnoW
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-17-2009 , 17:27   Re: How to show HP when you get more.
Reply With Quote #9

ye but hp can be not 100, for example 100800 or so
__________________
xPaw is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 01-17-2009 , 18:13   Re: How to show HP when you get more.
Reply With Quote #10

Did you try the code?..
__________________
hleV 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 01:46.


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