Raised This Month: $ Target: $400
 0% 

Glow Damage


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 20:25.


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