PDA

View Full Version : [HELP] Timers whene dying


Saw®
14/06/2012, 10:44 AM
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 ;) .

KosmasRego
14/06/2012, 10:50 AM
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.

Rudy_
14/06/2012, 10:58 AM
Use SetPlayerCameraPos

Saw®
14/06/2012, 10:59 AM
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 ;)

KosmasRego
14/06/2012, 11:02 AM
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 TogglePlayerControllable(playerid, 0); in the "public OnPlayerSpawn function under the TogglePlayerControllable(playerid, 0);"

Saw®
14/06/2012, 11:07 AM
Thank you ! ++rep i will test it now

KosmasRego
14/06/2012, 11:14 AM
I have a mistake at

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

change it to:

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

Saw®
14/06/2012, 11:23 AM
yeah i edited & slaped my self but doesn't work i can send to u my server's IP if u want..

KosmasRego
14/06/2012, 11:25 AM
yeah send it to me in pm