Still coming to Spawn loc.
#1

Hello,
I'm trying to make if i die, that i come to All Saints
Hospital.
I use this scripts :
Quote:

public OnPlayerDeath(playerid, killerid, reason)
{
SetPlayerPos(playerid,1182.7733,-1323.6193,13.5785);
return 1;
}

But when i die, i teleport to All Saints and i die there, and i
come back to my Spawn Place :S
Who can help me?
Reply
#2

pawn Код:
new pDeath[MAX_PLAYERS];
pawn Код:
//OnPlayerDeath
pDeath[playerid] = 1;
pawn Код:
//OnPlayerSpawn
if(pDeath[playerid] == 1) {
SetPlayerPos(playerid,1182.7733,-1323.6193,13.5785);
}
Reply
#3

Quote:
Originally Posted by Conroy
pawn Код:
new pDeath[MAX_PLAYERS];
pawn Код:
//OnPlayerDeath
pDeath[playerid] = 1;
pawn Код:
//OnPlayerSpawn
if(pDeath[playerid] == 1) {
SetPlayerPos(playerid,1182.7733,-1323.6193,13.5785);
}
thank you very much!
Can you do it with a timer?
That if a player dies that he get a 3D text on the screen
that he need to wait 60 second, and then spawn at hospital?
Reply
#4

pawn Код:
new pDeath[MAX_PLAYERS];

forward DeathTimer(id);
pawn Код:
//OnPlayerDeath
pDeath[playerid] = 1;
SetTimerEx("DeathTimer", 60000, false, "d", playerid);
pawn Код:
//OnPlayerRequestSpawn
if(pDeath[playerid] == 1) return 0;
pawn Код:
public DeathTimer(id)
{
pDeath[playerid] = 0;
SpawnPlayer(id);
return 1;
}
Unsure if OnPlayerRequestSpawn is used after the player dies, try it though.
Reply
#5

Quote:
Originally Posted by Conroy
pawn Код:
new pDeath[MAX_PLAYERS];

forward DeathTimer(id);
pawn Код:
//OnPlayerDeath
pDeath[playerid] = 1;
SetTimerEx("DeathTimer", 60000, false, "d", playerid);
pawn Код:
//OnPlayerRequestSpawn
if(pDeath[playerid] == 1) return 0;
pawn Код:
public DeathTimer(id)
{
pDeath[playerid] = 0;
SpawnPlayer(id);
return 1;
}
Unsure if OnPlayerRequestSpawn is used after the player dies, try it though.
Thanks again, i see you are experienced in Scriprintg
i have one problem, i want that the player sees the
hospital from the air and that he needs to wait 60 second
to spawn, and there must be a 3D text in the middle of the
screen, wait 60 seconds.
Reply
#6

Change OnPlayerRequestSpawn to:

pawn Код:
if(pDeath[playerid] == 1) {
SetPlayerCameraPos(playerid, /*Float:x, Float:y, Float:z*/); //Change the Floats to the camera co ords.
SetPlayerCameraLookAt(playerid, /*Float:x, Float:y, Float:z*/); //Change to the co ords where you want to camera to look at, Example: Hospital main enterance
GameTextForPlayer(playerid, "~w~Please wait 60 seconds before respawning", 60000, 3);
return 0;
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)