Warum funktioniert das nicht so wie ich es will?
forward rundentimer(playerid); // wenn dieser timer abgelaufen ist, sollen alle neu Spawnen
new KillerID[MAX_PLAYERS];
new bool: PlayerDied[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
SetTimerEx("rundentimer", 120000, 1, "d", playerid); // 2 Minuten
}
public OnPlayerSpawn(playerid)
{
if(PlayerDied[playerid] == true)
{
PlayerDied[playerid] = false;
if(KillerID[playerid] != INVALID_PLAYER_ID)
{
if(IsPlayerInAnyVehicle(KillerID[playerid]))
{
SetPlayerInterior(playerid,GetPlayerInterior(KillerID[playerid]));
TogglePlayerSpectating(playerid, 1);
PlayerSpectateVehicle(playerid, GetPlayerVehicleID(KillerID[playerid]));
}
else
{
SetPlayerInterior(playerid,GetPlayerInterior(KillerID[playerid]));
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, KillerID[playerid]);
}
TogglePlayerSpectating(playerid, 1);
}
else
{
SetPlayerCameraPos(playerid, 2767.2854,-2417.8667,13.6326);
SetPlayerCameraLookAt(playerid, 2775.5989,-2417.9575,13.6366);
TogglePlayerControllable(playerid, 0);
SetPlayerPos(playerid, 2775.5989,-2417.9575,13.6366);
}
}
else if(PlayerDied[playerid] == false)
{
//soll er ganz normal wieder spawnen
}
}
public OnPlayerDeath(playerid, killerid, reason)
{
KillerID[playerid] = killerid;
PlayerDied[playerid] = true;
}
So nun kommt der Timer:
public rundentimer(playerid)
{
PlayerDied[playerid] = false;
SetPlayerHealth(playerid, 0.0);
print("Neue Runde gestartet");
}
Doch irgendwie wird das PlayerDied[playerid] = false; völlig ignoriert und er führt was ganz anderes aus. Was kann ich machen
//EDIT: wo ich mir jez im nachhinein OnPlayerDeath und rundentimer(playerid) angucke, is ja eigtl klar warums net geht xD Wenn ich SetPlayerHealth(playerid, 0.0); mache is er ja wieder tot und alles beginnt von vorne..... Habt ihr vielleicht ne andere Lösung?