20.05.2013, 18:03
Hello, I got a problem with some timers. When you enter a specific area where you are not allowed, you start to loose health. You start to loose health, but it wont stop, even if you go away.
Here is the code:
I cant figure out whats wrong.
Any help would be appreciated
Here is the code:
Код:
new bool:IsInArea[MAX_PLAYERS];
new HealthTimer[MAX_PLAYERS];
forward areacheck();
forward health(playerid);
public OnGameModeInit()
{
SetTimer("areacheck", 200, 1);
}
public areacheck()
{
for (new i=0; i<MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if (IsPlayerInRangeOfPoint(put things here) && IsInArea[i]==false)
{
HealthTimer[i]=SetTimerEx("health", 400, 1, "i", i);
IsInArea[i]=true;
}
else
{
if (IsInArea[i]==true)
{
IsInArea[i]=false;
KillTimer(HealthTimer[i]);
}
}
}
}
}
public health(playerid)
{
new Float:h;
GetPlayerHealth(playerid, h);
SetPlayerHealth(playerid, h-5)
}
Any help would be appreciated

