superbird
01-09-2012, 06:24
Hey I am trying to get health regen working and I have had 2 different outcomes.
1. Health regen works for the way it should but stops altogether all of a sudden.
2. Health regen works for 1 person the whole game.
This is the code that comes up with 2.
public Action:PlayerRegen(Handle:timer, any:user)
{
for (new i=1; i<=MaxClients; i++)
{
if (GetClientHealth(i) <= 500)
{
if (GetClientTeam(i) == 2)
{
SetEntityHealth(i, GetClientHealth(i) + 20);
}
}
if (GetClientHealth(i) >= 500)
{
if (GetClientTeam(i) == 2)
{
SetEntityHealth(i, 500);
}
}
}
}
It is running off a timer, that is starting on round start and being killed on round end.
I am really stumped on this one. I'd assume its something to do with MaxClients. Console is constantly spammed with it looking for the player that's 1 above the current amount of players.
1. Health regen works for the way it should but stops altogether all of a sudden.
2. Health regen works for 1 person the whole game.
This is the code that comes up with 2.
public Action:PlayerRegen(Handle:timer, any:user)
{
for (new i=1; i<=MaxClients; i++)
{
if (GetClientHealth(i) <= 500)
{
if (GetClientTeam(i) == 2)
{
SetEntityHealth(i, GetClientHealth(i) + 20);
}
}
if (GetClientHealth(i) >= 500)
{
if (GetClientTeam(i) == 2)
{
SetEntityHealth(i, 500);
}
}
}
}
It is running off a timer, that is starting on round start and being killed on round end.
I am really stumped on this one. I'd assume its something to do with MaxClients. Console is constantly spammed with it looking for the player that's 1 above the current amount of players.