Raised This Month: $ Target: $400
 0% 

Test this?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 05-29-2006 , 23:47   Test this?
Reply With Quote #1

I don't have access to any servers, so can you guys test this out real quick. More games the merrier.

It should make every player glow by how much health they have.

100 = Green
10 = Red

The lower the health the more red it turns.

Thanks a bunch.
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 05-30-2006 , 00:02  
Reply With Quote #2

1) What you have would only be run once.
2) Using if's like that is shit.
3) Lets work on this.

Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {     register_plugin("Glow by Health", "1.0", "Kensai")     register_event("Damage" , "health" , "b" , "2!0")     register_event("ResetHUD" , "health" , "b" ) } public health(id) {     new health = get_user_health(id)         switch(health)     {         case 100: set_user_rendering(id, kRenderFxGlowShell, 0, 187, 4, kRenderTransAlpha, 255)         case 90..99: set_user_rendering(id, kRenderFxGlowShell, 47, 187, 0, kRenderTransAlpha, 255)         case 80..89: set_user_rendering(id, kRenderFxGlowShell, 94, 187, 0, kRenderTransAlpha, 255)         case 70..79: set_user_rendering(id, kRenderFxGlowShell, 131, 186, 1, kRenderTransAlpha, 255)         case 60..69: set_user_rendering(id, kRenderFxGlowShell, 172, 186, 1, kRenderTransAlpha, 255)         case 50..59: set_user_rendering(id, kRenderFxGlowShell, 186, 182, 1, kRenderTransAlpha, 255)         case 40..49: set_user_rendering(id, kRenderFxGlowShell, 185, 157, 2, kRenderTransAlpha, 255)         case 30..39: set_user_rendering(id, kRenderFxGlowShell, 186, 140, 1, kRenderTransAlpha, 255)         case 20..29: set_user_rendering(id, kRenderFxGlowShell, 187, 98, 0, kRenderTransAlpha, 255)         case 10..19: set_user_rendering(id, kRenderFxGlowShell, 186, 56, 1, kRenderTransAlpha, 255)         default: set_user_rendering(id, kRenderFxGlowShell, 187, 0, 0, kRenderTransAlpha, 255)     }             return PLUGIN_CONTINUE; }

Much better.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 05-30-2006 , 15:54  
Reply With Quote #3

Ah okay. Didn't know how to use a switch statement like that. So I had to use the ifs.

And thanks for the events.
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
KoST
Senior Member
Join Date: Jul 2005
Old 05-30-2006 , 16:31  
Reply With Quote #4

what about this?

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define MAX_COLOR 187 public plugin_init() {     register_plugin("Glow by Health", "1.0", "Kensai")     register_event("Damage" , "health" , "b" , "2!0")     register_event("ResetHUD" , "health" , "b" ) } public health(id) {     new health = get_user_health(id)     new Float:factor=float(MAX_COLOR)/100.0 //1.87     new r=MAX_COLOR-floatround((float(health)*factor))     new g=floatround((float(health)*factor))     set_user_rendering(id, kRenderFxGlowShell, r, g, 4, kRenderTransAlpha, 255)     return PLUGIN_CONTINUE; }

[edit] thx VEN !
__________________
KoST is offline
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 05-30-2006 , 16:33  
Reply With Quote #5

Ahhh lots of math...but about 5 times shorter
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 05-30-2006 , 16:43  
Reply With Quote #6

I would have done that but I wasn't in the mood to do math....So I just fixed his if's into something better.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
VEN
Veteran Member
Join Date: Jan 2005
Old 05-30-2006 , 18:29  
Reply With Quote #7

KoST: this will not work as you expect.
Quote:
Originally Posted by BAILOPAN
A re-tag is a bitstring copy, not a type cast
Use floatround native.
VEN 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:29.


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