Need Help :D
#1

So i need to know how can i spawn player after death in place he died Simple, huh? So explain it to me
Код:
public MaloZycia(playerid)
{
    new Float:health;
    GetPlayerHealth(playerid,health);
    if (health < 2.0)
    {
    	TogglePlayerControllable(playerid, 0);
        ApplyAnimation(playerid, "SWEET", "Sweet_injuredloop", 4.1,1,1,1,1,0,1);
    	SetTimer("bw",4800000,false);
	}
}

public bw()
{
	for (new i = 0; i < MAX_PLAYERS; i++)
	TogglePlayerControllable(i, 1);
}
Reply
#2

Eh, where's that code for?

Anyways, get his position when he dies and then set when the player spawns again.
Reply
#3

pawn Код:
new Float:x,Float:y,Float:z;
//onplayerdeath
GetPlayerPos(playerid,x,y,z);
//onplayerspawn
SetPlayerPos(playerid,x,y,z);
Should do it :P
Reply
#4

This code is for brutally wounded system... So when player dies he must remain in death postion some time in unconscious state. Yeah, i don't know how to get his death position, i need explanation
Reply
#5

Save his position in OnPlayerDeath, e.g. in an global array for every player. In OnPlayerSpawn you can set the pos again then with the values you stored - maybe with another check, if he should only spawn there, if he is healed or so.

pawn Код:
On the top with the other variables:
new Float:deathpos[MAX_PLAYERS][3];

In OnPlayerDeath:
GetPlayerPos(playerid, deathpos[playerid][0], deathpos[playerid][1], deathpos[playerid][2]);

in OnPlayerSpawn:
SetPlayerPos(playerid, deathpos[playerid][0], deathpos[playerid][1], deathpos[playerid][2]);
Reply
#6

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
Save his position in OnPlayerDeath, e.g. in an global array for every player. In OnPlayerSpawn you can set the pos again then with the values you stored - maybe with another check, if he should only spawn there, if he is healed or so.

pawn Код:
On the top with the other variables:
new Float:deathpos[MAX_PLAYERS][3];

In OnPlayerDeath:
GetPlayerPos(playerid, deathpos[playerid][0], deathpos[playerid][1], deathpos[playerid][2]);

in OnPlayerSpawn:
SetPlayerPos(playerid, deathpos[playerid][0], deathpos[playerid][1], deathpos[playerid][2]);
That's going to set your x,y, and z coordinates to 0 when you spawn after connecting to the server.

pawn Код:
new IsPlayerDead[MAX_PLAYERS]; //On top of script
pawn Код:
OnplayerDeath(playerid, killerid, reason)
{
    IsPlayerDead = 1;
    return 1;
}
pawn Код:
OnPlayerSpawn(playerid)
{
    if(IsPlayerDead[playerid] == 1)
    {
        //Do stuff here
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)