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?
__________________