I need death system
#1

Hey all i need death system to my server like when you die you respawn at hospital any idea link?
Reply
#2

pawn Code:
OnPlayerDeath(playerid, other stuff)
{
    SetPlayerPos(playerid,x , y , z);
return 1;
}
Shud work
Fill in xyz with the chords of ur hospital...
Reply
#3

Not hard at all.

You need to create a global variable like:

pawn Code:
// 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;
}
Reply
#4

Quote:
Originally Posted by grand.Theft.Otto
View Post
Not hard at all.

You need to create a global variable like:

pawn Code:
// 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?
Reply
#5

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.
Reply
#6

Use timers so you can also make a small RP scene?
Reply
#7

Quote:
Originally Posted by Brucey
View Post
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.
Reply
#8

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 )
Reply
#9

My global variable could come in handy sometime though, for admins preferably or for certain people that have the privilege to skip the hospital
Reply
#10

True, but that could also be scripted under OnPlayerDeath by getting their name.
Reply
#11

public OnPlayerDeath(playerid, killerid, reason)
{
SetPlayerPos(playerid, 1180.3501,-1372.6008,-38.3573);
return 1;
}
Reply
#12

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.

Code:
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;
}
Reply
#13

Put that SetPlayerPos in OnPlayerSpawn, not OnPlayerDeath
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)