problem with deathsystem
#1

Hello,
here is the next of my problems: I'm currently writing a deathsystem. The following should happen:
Medic is online: The player dies, gets teleported back to the point of death, the animation "crack" starts, he is getting uncontrollable and a message to all the medics will be sent. Now a timer is started which runs for 3 minutes. If it expires, the player will be teleported to the hospital and loose 1,500$. If a medic is healing him with /defi he only loose 500$.
Medic is not online / afk: The player loses $ 1000 and is teleported to the hospital (teleport is not yet implemented).
Here's the problem: Player dies, Medic is online and nothing happens.

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	GetPlayerPos(playerid,Spieler[playerid][totx],Spieler[playerid][toty],Spieler[playerid][totz]);
	gestorben[playerid] = true;
	return 1;
}

// Under OnPlayerSpawn
	if(gestorben[playerid] == true)
	{
		for(new i=0; i<MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
			if(medic[i] == true)
			{
  				SetPlayerPos(playerid, Spieler[playerid][totx], Spieler[playerid][toty], Spieler[playerid][totz]);
				ApplyAnimation(playerid,"CRACK","crckdeth1",4.1,1,1,1,1,1);
				TogglePlayerControllable(playerid, 0);
				timer[playerid] = SetTimerEx("death", 180000, false, "is", playerid, name);
		    	if(i != playerid)
		    	{
					format(path,sizeof(path),"%s ist schwer verletzt. Sofort zum Versorgen ausrьcken.", name);
					SendClientMessage(i, COLOR_RED, path);
					SendClientMessage(playerid, COLOR_GREEN, "Du hattest einen schweren Unfall! Ein Krankenwagen wurde schon gerufen.");
				}

				else if (i == playerid || afk[i] == true)
				{
					SendClientMessage(playerid, COLOR_RED, "Es war kein Notarzt erreichbar, dir wurden 1000$ fьr die Behandlung abgezogen.");
					gestorben[playerid] = false;
					GivePlayerMoney(playerid,-1000);
					KillTimer(timer[playerid]);
				}
			}
			}
		}
	}
I hope you can help.

Thanks
Padarom
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)