problem with deathsystem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: problem with deathsystem (
/showthread.php?tid=237372)
problem with deathsystem -
Padarom - 09.03.2011
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