Raised This Month: $ Target: $400
 0% 

Glow Damage


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Fun Stuff       
SAMURAI16
BANNED
Join Date: Sep 2006
Old 01-06-2007 , 15:38   Glow Damage
Reply With Quote #1

Glow Damage v0.1.0

* Details : Makes players glow when damaged.

* Cvars:
glowdamage_type 1/2
1= Random Colors
2= Colors in function by user team : Terro Team and CT Team and if Damage > 15 have some colors,
else if damage > 40 have another colors, etc

* Tests:
- Tested on CS 1.6 with AMXMODX 1.76b

* Required Modules
- Fun & Cstrike

* Credits:
- Doombringer for an fixed on CS Teams
- MaximusBrood for if conditions fixes
Attached Files
File Type: sma Get Plugin or Get Source (glow_damage.sma - 1302 views - 3.5 KB)

Last edited by SAMURAI16; 01-07-2007 at 06:05.
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
uTg | bigpapajiggs
Senior Member
Join Date: Sep 2005
Location: Bellingham, WA
Old 01-06-2007 , 16:31   Re: Glow Damage
Reply With Quote #2

Do they stop glowing eventually? Or permanent glow?
__________________
What's my confidence level? I do crossword puzzles with a pen.
uTg | bigpapajiggs is offline
Send a message via AIM to uTg | bigpapajiggs Send a message via MSN to uTg | bigpapajiggs Send a message via Yahoo to uTg | bigpapajiggs
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 01-06-2007 , 17:45   Re: Glow Damage
Reply With Quote #3

The following is your "death_event". Why you call it "death", I don't know.
Code:
public death_event() {         new r,g,b           new Victim = read_data(0)         new Damage = get_user_health(Victim)           new CsTeams:playert = cs_get_user_team(Victim)           switch (get_pcvar_num(pcvartype))         {                 case 1:                 {                         // random num for r,g,b colors                         r = random_num(0,255)                         g = random_num(0,255)                         b = random_num(0,255)                 }                 case 2:                 {                         // if is user from Terro team                         if (playert == CS_TEAM_T && Damage > 40)                         {                                 r = 255                                 g = 0                                 b = 0                         }                         else if(playert == CS_TEAM_T)                         {                                 r = 255                                 g = 80                                 b = 0                         }                         else if(playert == CS_TEAM_T && Damage > 15 && Damage < 40)                         {                                 r = 200                                 g = 70                                 b = 0                         }                         if(playert == CS_TEAM_CT && Damage > 40)                         {                                                                                                  r = 0                                 g = 255                                 b = 0                                  }                         else if(playert == CS_TEAM_CT)                         {                                 r = 23                                 g = 243                                 b = 0                         }                         else if(playert == CS_TEAM_CT && Damage > 15 && Damage < 50)                         {                                 r = 0                                 g = 65                                 b = 12                         }                 }         }         playerglow(Victim,r,g,b)           return PLUGIN_CONTINUE; }

Problems.
  • You need to handle the case when the user's team returned is not 1 or 2.
  • Your if logic is flawed. The third case for both T and CT will never be reached.
  • Your if logic is flawed again. You're forcing the server to check too many cases. For instance, if your first check sees that the player isn't a T, you force the server to check again, twice more, before finally checking if it's a CT.
Did you actually test this?
__________________
Brad is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 01-07-2007 , 04:14   Re: Glow Damage
Reply With Quote #4

-updated . Before this update glow was permanent, now glow are present only when you hit an enemy
Brad how should like codes to not be "flawed"
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 01-07-2007 , 04:38   Re: Glow Damage
Reply With Quote #5

Gj SAMURAI16 ;) *when i hit a enemy he start glow....but he glow and next round.....and next round......
*When the round end......player must stop glowing and the next round shouldn't glow until he is hit!
Alka is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 01-07-2007 , 04:43   Re: Glow Damage
Reply With Quote #6

i fixed it now
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 01-07-2007 , 04:53   Re: Glow Damage
Reply With Quote #7

Now works very fine ..should be approved...

Last edited by Alka; 01-07-2007 at 04:56.
Alka is offline
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 01-07-2007 , 06:00   Re: Glow Damage
Reply With Quote #8

Quote:
Originally Posted by SAMURAI16 View Post
i fixed it now
No, it's not. You didn't do anything Brad told you.
Your stopglow function was also flawed: you didn't check if the player was still connected.
Fixed code:

Code:
/*  Glow Damage v0.1.0   * Details : Makes players glow when damage. * Cvars: glowdamage_type 1/2 1= Random Colors 2= Colors in function by user team : Terro Team and CT Team and if Damage > 15 have some colors, else if damage > 40 have another colors, etc * Tests: - Tested on CS 1.6 with AMXMODX 1.76b * Required Modules - Fun & Cstrike * Credits: - Doombringer for an fixed on CS Teams Have a nice day now */ #include <amxmodx> #include <fun> #include <cstrike>   new const PLUGIN[] = "Glow Damage" new const VERSION[] = "0.1.0" new const AUTHOR[] = "SAMURAI"   new pcvartype;   public plugin_init() {         register_plugin(PLUGIN, VERSION, AUTHOR)         pcvartype = register_cvar("glowdamage_type","1")         register_event("Damage","glow_event","b","2!0","3=0","4!0")           }     public glow_event() {         new r,g,b           new Victim = read_data(0)         new Damage = get_user_health(Victim)           new CsTeams:playert = cs_get_user_team(Victim)           switch (get_pcvar_num(pcvartype))         {                 case 1:                 {                         // random num for r,g,b colors                         r = random_num(0,255)                         g = random_num(0,255)                         b = random_num(0,255)                 }                         case 2:                 {                         // if is user from Terro team                         if(playert == CS_TEAM_T)                         {                             if (Damage <= 15)                             {                                 r = 255                                 g = 80                                 b = 0                             } else if(Damage >= 40)                             {                                 r = 255                                 g = 0                                 b = 0                             } else                             {                                 r = 200                                 g = 70                                 b = 0                             }                         } else                         {                             if(Damage <= 15)                             {                                 r = 23                                 g = 243                                 b = 0                             } else if(Damage >= 40)                             {                                 r = 0                                 g = 255                                 b = 0                             } else                             {                                 r = 0                                 g = 65                                 b = 12                             }                         }                 }         }                 playerglow(Victim,r,g,b)           return PLUGIN_HANDLED } public playerglow(player,r,g,b) {     new Params[1]     Params[0] = player        set_user_rendering(player,kRenderFxGlowShell,r,g,b,kRenderNormal,25)     set_task(1.0,"stopglow",0,Params,1);                       } public stopglow(Params[]) {     if(!is_user_connected(params[0]))         return PLUGIN_HANDLED;         set_user_rendering(Params[0],kRenderFxGlowShell,0,0,0,kRenderNormal,25) }
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 01-07-2007 , 06:06   Re: Glow Damage
Reply With Quote #9

ah - Thanks man . I fexed that and an bug on params
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 01-07-2007 , 15:17   Re: Glow Damage
Reply With Quote #10

You clearly still have no idea what you're doing. I don't think you will be able to support this if any other problems with it arise. It's also sort of redundant (there are glow by health plugins and stuff like that).

Unapproved.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
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 16:31.


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