Putting player back to his death position - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Putting player back to his death position (
/showthread.php?tid=148436)
Putting player back to his death position -
IVuljak - 17.05.2010
Hi, I have a problem of putting player back to the position where he died
Here is the example code
pawn Код:
new PlayerIsDead[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerIsDead[playerid] = 1;
//position, interior, virtual world
// ...
return 1;
}
public OnPlayerSpawn(playerid)
{
if(PlayerIsDead[playerid] == 1)
{
//put player back to his position of death (also set his interior and virtual world
ApplyAnimation(playerid,"PED","KO_skid_front",4.1,0,1,1,1,0);
TogglePlayerControllable(playerid, 0);
SetPlayerHealth(playerid, 10);
SendClientMessage(playerid, COLOR_RED, "You're badly injured. If the medics don't come in time you will die.");
}
// ...
return 1;
}
My question is how can I put him back to the death position and also get interior an dvirtual world where he died?
Somebody please help..
Re: Putting player back to his death position -
shady91 - 17.05.2010
pawn Код:
new PlayerIsDead[MAX_PLAYERS];
new World[MAX_PLAYERS];
new Interior[MAX_PLAYERS];
new Float:x[MAX_PLAYERS];
new Float:y[MAX_PLAYERS];
new Float:z[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
GetPlayerPos(playerid, x[playerid], y[playerid], z[playerid]);
World[playerid] = GetPlayerVirtualWorld(playerid);
Interior[playerid] = GetPlayerInterior(playerid);
PlayerIsDead[playerid] = 1;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(PlayerIsDead[playerid] == 1)
{
SetPlayerPos(playerid, x[playerid], y[playerid], z[playerid]);
SetPlayerVirtualWorld(playerid, World[playerid]);
SetPlayerInterior(playerid, Interior[playerid]);
ApplyAnimation(playerid,"PED","KO_skid_front",4.1,0,1,1,1,0);
TogglePlayerControllable(playerid, 0);
SetPlayerHealth(playerid, 10);
SendClientMessage(playerid, COLOR_RED, "You're badly injured. If the medics don't come in time you will die.");
}
// ...
return 1;
}
This is not tested just an example. Your better off using the Pvar system