SA-MP Forums Archive
[HELP] Timers whene dying - 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)
+--- Thread: [HELP] Timers whene dying (/showthread.php?tid=350905)



[HELP] Timers whene dying - Saw® - 14.06.2012

Hi , i have a big problem with the timers (i do not know how to use them propely) , so i want to set a timer whene a player disconnect & go to hospital , he must wait 20 sec in the hospital before exit.
So there is my Questions :
1-How to set this timer (players after dead they must wait 20sec in the hospital ) ?

2-i addeded setplayerpos function under the callback Public OnPlayerDeath , but this cause a problem , whene a player just dead , the screen begin to move right and left..(it is normal in GTA) , but i can't see my dead player so he teleport fastley..
-How to fix that ?

Yes i steel newbie in timers & some callback,sorry , i hope you help me .


Re: [HELP] Timers whene dying - KosmasRego - 14.06.2012

As for the 1st I will create it for you in a filterscript.


As for the 2nd it sets the player position when he dies not when he spawns so you must also think something on your own like create a pInfo or anything else.


Re: [HELP] Timers whene dying - Rudy_ - 14.06.2012

Use SetPlayerCameraPos


Re: [HELP] Timers whene dying - Saw® - 14.06.2012

thank you !
for the 2nd i don't want to set whene he spawns i want to set it whene player dead so teleport him to hospital , then he must wait 20sec then he go out thant's all


Re: [HELP] Timers whene dying - KosmasRego - 14.06.2012

There you go http://pastebin.com/BPejUfAF

Complie it in filterscripts folder then open server.cfg and add in Filterscripts line DeathTimer.

NOTE: You have to set the hospital coordinates yourself at
pawn Код:
TogglePlayerControllable(playerid, 0);
in the "public OnPlayerSpawn function under the TogglePlayerControllable(playerid, 0);"


Re: [HELP] Timers whene dying - Saw® - 14.06.2012

Thank you ! ++rep i will test it now


Re: [HELP] Timers whene dying - KosmasRego - 14.06.2012

I have a mistake at

pawn Код:
public DeathTimer(playerid)
{
        PlayerInfo[playerid][pJustDied] = 0;
        SendClientMessage(playerid, COLOR_YELLOW, "You have to wait 20 seconds.");
        return 1;
}
change it to:

pawn Код:
public DeathTimer(playerid)
{
        PlayerInfo[playerid][pJustDied] = 0;
        TogglePlayerControllable(playerid, 1);
        SendClientMessage(playerid, COLOR_YELLOW, "You have to wait 20 seconds.");
        return 1;
}



Re: [HELP] Timers whene dying - Saw® - 14.06.2012

yeah i edited & slaped my self but doesn't work i can send to u my server's IP if u want..


Re: [HELP] Timers whene dying - KosmasRego - 14.06.2012

yeah send it to me in pm