Hallo,
der Titel sagt bereits alles. Der Timer wird trotz KillTimer nicht gekillt und ich hab nicht die leiseste Ahnung wieso. Da ich das ganze immer alleine gestetet habe, beziehe ich mich auf die letzte if-Abfrage, also ob a kleiner gleich 0 ist. Wenns da aber schon fehlschlägt, dann wohl in der ganzen Funktion.
//Globale Variable
new Downstate_Timer[MAX_PLAYERS];
//Unter OnPlayerSpawn
Downstate_Timer[playerid] = SetTimerEx("DownstateTimer", 250, true, "i", playerid);
//Timer Funktion
forward DownstateTimer(playerid);
public DownstateTimer(playerid)
{
Downstate_Counter[playerid]++;
if(Downstate_Counter[playerid] == 4)
{
Downstate_Counter[playerid] = 0;
new Float:a;
GetPlayerArmour(playerid, a);
if(0.0 < a < 100.0)
{
SetPlayerArmour(playerid, a - 1.0);
}
if(a == 100.0)
{
KillTimer(Downstate_Timer[playerid]);
Condition[playerid] = CONDITION_ALIVE;
Downstate_Counter[playerid] = 0;
ClearAnimations(playerid);
SetPlayerHealth(playerid, 30);
SetPlayerArmour(playerid, 0);
//TO DO: Hide all textdraws from the downstate
}
if(a <= 0.0)
{
KillTimer(Downstate_Timer[playerid]);
Condition[playerid] = CONDITION_DEAD;
Downstate_Counter[playerid] = 0;
ApplyAnimation(playerid, "CRACK", "crckdeth1", 4.1, false, true, true, true, 24*60000, true);
//TO DO: Offer Respawn Hotkey
PlayerTextDrawHide(playerid, TD_Downstate[playerid][0]); //Downstate
PlayerTextDrawHide(playerid, TD_Downstate[playerid][1]); //WeaponCoverBox
PlayerTextDrawHide(playerid, TD_Downstate[playerid][2]); //Infobox
PlayerTextDrawHide(playerid, TD_Downstate[playerid][3]); //HealthCoverBox
PlayerTextDrawHide(playerid, TD_Downstate[playerid][4]); //Indicator arrow
PlayerTextDrawHide(playerid, TD_Downstate[playerid][5]); //Stop the bleeding
PlayerTextDrawHide(playerid, TD_Downstate[playerid][6]); //Cry for help
PlayerTextDrawHide(playerid, TD_Downstate[playerid][7]); //Last strength
PlayerTextDrawHide(playerid, TD_Downstate[playerid][8]); //Medicine
PlayerTextDrawHide(playerid, TD_Downstate[playerid][9]); //Up and down arrow of main circle
PlayerTextDrawHide(playerid, TD_Downstate[playerid][10]); //Left and right arrow of main circle
PlayerTextDrawHide(playerid, TD_Downstate[playerid][11]); //Medicine drop down menu
PlayerTextDrawHide(playerid, TD_Downstate[playerid][12]); //Close box info
//TO DO: Hide downstate action textdraws and infobox (when respawned, hide all downstate textdraws)
}
}
return 1;
}