Hey guys, I did a script, just like the title says, and hooked it up as a HAM, and for some wierd reason, after g_IsStarted is being set to true, when someone shoots his teammate's leg, which is way less than 100 or 50 HP, it is printing both messages at the same time, and for some reason it detects that the damage the player did to his teammates (which is stored in g_LeftKills) is more than 100.... someone can see the bug?
PHP Code:
public tk(victim, inflictor, killer, damage, bits)
{
if (killer == victim)
{
damage = 0
}
if (g_IsStarted)
{
if ((cs_get_user_team(killer) == cs_get_user_team(victim)))
{
new temp
if (g_LeftKills[killer] >= 100)
{
temp = 1
}
if (temp != 1)
{
g_LeftKills[killer] += damage
if (g_LeftKills[killer] > 50)
{
client_print(killer, print_chat, "%s Warning! Attacking your teammates can get you banned.", PREFIX)
}
if (g_LeftKills[killer] >= 100)
{
new nameofp[50]
get_user_name(killer, nameofp, 49)
client_print(0, print_chat ,"%s If %s is team attacking just to be annoying, use .voteban", PREFIX, nameofp)
}
}
}
}
return PLUGIN_CONTINUE
}
Here is the register:
PHP Code:
RegisterHam(Ham_TakeDamage, "player", "tk")
Also, at public client_connect, g_leftkills of a user is being set to 0, so its not a pervious set...