PDA

View Full Version : I need death system


GTA-Roleplay
10/10/2011, 09:02 PM
Hey all i need death system to my server like when you die you respawn at hospital any idea link?

knackworst
10/10/2011, 09:07 PM
OnPlayerDeath(playerid, other stuff)
{
SetPlayerPos(playerid,x , y , z);
return 1;
} Shud work
Fill in xyz with the chords of ur hospital...

grand.Theft.Otto
10/10/2011, 09:20 PM
Not hard at all.

You need to create a global variable like:


// top of script

new SpawnInHospital[MAX_PLAYERS];

// under onplayerdeath

SpawnInHospital[playerid] = 1;

// under onplayerspawn

if(SpawnInHospital [playerid] == 1)
{
// set their pos to the hospital
// set virtual world and interior
// etc
return 1;
}

Kush
10/10/2011, 09:47 PM
Not hard at all.

You need to create a global variable like:


// top of script

new SpawnInHospital[MAX_PLAYERS];

// under onplayerdeath

SpawnInHospital[playerid] = 1;

// under onplayerspawn

if(SpawnInHospital [playerid] == 1)
{
// set their pos to the hospital
// set virtual world and interior
// etc
return 1;
}



Why?

.:Kaos:.
10/10/2011, 09:49 PM
You don't need to create a global variable? All you have to do is what knackworst said. Set them to spawn in the hospital. If you wanted to get really fancy, you could include message's, animations of them laying in the bed and a timer until they can get up. You also might want to set the interior, so they actually spawn in the hospital.

Brucey
10/10/2011, 09:52 PM
Use timers so you can also make a small RP scene?

.:Kaos:.
10/10/2011, 09:54 PM
Use timers so you can also make a small RP scene?
Yeah, I'm not sure what you're saying. Are you asking if that's what I meant?

*Edit: Ah Alright, yeah that's what I was getting at. Depends on how RP they want it to be.

Brucey
10/10/2011, 09:56 PM
Yeah, it's what you said, but you can easily add some timers to make it look more "RPish". ( If that's what he wants to reach )

grand.Theft.Otto
10/10/2011, 10:15 PM
My global variable could come in handy sometime though, for admins preferably or for certain people that have the privilege to skip the hospital :D

.:Kaos:.
10/10/2011, 10:44 PM
True, but that could also be scripted under OnPlayerDeath by getting their name.

Super_Panda
10/10/2011, 11:16 PM
public OnPlayerDeath(playerid, killerid, reason)
{
SetPlayerPos(playerid, 1180.3501,-1372.6008,-38.3573);
return 1;
}

Stm
23/05/2012, 08:09 PM
I have a problem after i fell from somewhere my health turns to 0 and teleports me in the cemetery and after my character dies im respawned to the spawn point.How i can make it after my character dies to teleport me to the cemetery?


Here what i have make so far. :D


public OnPlayerDeath(playerid, killerid, reason)
{
SetPlayerPos(playerid, 811.8060,-1098.2509,25.9063);
SendClientMessage(playerid, 0xEBF224FF, "You have died.You will be spawn in the cemetery");
return 1;
}

kaisersouse
23/05/2012, 08:28 PM
Put that SetPlayerPos in OnPlayerSpawn, not OnPlayerDeath