[Hospital System] Timer and Respawn place
#1

Hey ,

Well I am trying to make it so when you die, your screen points at the hospital and a timer of 60 seconds goes and when its done you spawn infront of the hospital and you have 100 hp. Here is what I did:

Код:
forward DEAD1();
public OnPlayerDeath(playerid, killerid, reason)
{
	SendClientMessage(playerid, COLOR_RED, "You're being rushed to the hospital!");
 	SetPlayerPos(playerid, 1221.7010,-1328.6449,13.4821);
  	SetPlayerCameraPos(playerid, 1204.3781,-1313.3323,16.3984);
	SetPlayerCameraLookAt(playerid, 1174.7167,-1323.4485,14.5938);
	SetTimer("DEAD1", 50000, 1);
	SetPlayerHealth(playerid,100);
	SetPlayerPos(playerid,1172.6569,-1323.2815,15.4025);
	return 1;
}
That was pretty much what I did for it, but when the person in the game dies they just spawn here:
Код:
	AddPlayerClass(0,362.7798,-1558.6129,32.8815,147.4366,0,0,0,0,0,0); // New Player Spawn
Not sure why but yea, am I doing something wrong ? thanks for reading and help ^-^!
Reply
#2

pawn Код:
forward DEAD1(playerid);
forward RespawnHospital(playerid);

public OnPlayerDeath(playerid)
{
    SetTimer("RespawnHospital", 3500, 0);
    return 1;
}

public RespawnHospital(playerid)
{
    SendClientMessage(playerid, COLOR_RED, "You're being rushed to the hospital!");
    SetPlayerPos(playerid, 1221.7010,-1328.6449,13.4821);
    SetPlayerCameraPos(playerid, 1204.3781,-1313.3323,16.3984);
    SetPlayerCameraLookAt(playerid, 1174.7167,-1323.4485,14.5938);
  TogglePlayerControllable(playerid,0);
    SetTimer("DEAD1", 50000, 0); // oops forgot to change that
    return 1;
}

public DEAD1(playerid);
{
    SetPlayerHealth(playerid,100);
    SetPlayerPos(playerid,1172.6569,-1323.2815,15.4025);
  TogglePlayerControllable(playerid,1);
    return 1;
}
Here you go
Reply
#3

Thanks for that but I have one last problem when the person dies they arent really stuck for the timer and how can I make it so that they are stuck while the timer is there and once its done they are unstuck and the camera goes back to normal atm they can move around and its like the timer isnt even working since the camera angel isnt going back to normal thanks for helping me im sorry if im annoying you .
Reply
#4

TogglePlayerControllable(playerid, 0); Makes them stuck cant move
TogglePlayerControllable(playerid, 1); Makes them unstuck and free to move

I think the code i gave you does that.. but let me test it hehe
Reply
#5

Okay thanks just tell me if you found out whats wrong ^-^
EDIT: thanks for help its working its not letting me move or see it and the timer is working !

I have to go thanks for all your help .
Reply
#6

No problem....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)