if a player dies.. - 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: if a player dies.. (
/showthread.php?tid=229988)
if a player dies.. -
davelord - 22.02.2011
hey, i want to create, that if a player dies, that he will be teleported back to the location he got shot/killed at if his/her rp reaches 0, then it will flip, and the player recreives a message: "You are wounded. Wait for a medic to arrive, or type /acceptdeath." Ok, so, when the player's rp reaches 100, the wounded stuff will stop, and the player will be teleported back, so the effect is over
Re: if a player dies.. -
maramizo - 22.02.2011
More like PR RP?
Re: if a player dies.. -
davelord - 22.02.2011
Yeah, or LS-RP.
Re: if a player dies.. -
FreshKilla - 22.02.2011
It's somewhat of some scripting to do but basically you would do:
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
SetPVarFloat(playerid, "Dead_PosX", X);
SetPVarFloat(playerid, "Dead_PosY", Y);
SetPVarFloat(playerid, "Dead_PosZ", Z);
SetPVarInt(playerid, "Dead_Int", GetPlayerInterior(playerid));
SetPVarInt(playerid, "Dead_World", GetPlayerVirtualWorld(playerid));
SetPVarInt(playerid, "Dead", 1);
}
public OnPlayerSpawn(playerid)
{
if(GetPVarInt(playerid, "Dead") == 1)
{
SetPlayerPos(playerid,GetPVarFloat(playerid, "Dead_PosX"),GetPVarFloat(playerid, "Dead_PosY"),GetPVarFloat(playerid, "Dead_PosZ"));
SetPlayerInterior(playerid,GetPVarInt(playerid, "Dead_Int"));
SetPlayerVirtualWorld(playerid,GetPVarInt(playerid, "Dead_World"));
DeletePVar(playerid,"Dead_PosX");
DeletePVar(playerid,"Dead_PosY");
DeletePVar(playerid,"Dead_PosZ");
DeletePVar(playerid,"Dead_Int");
DeletePVar(playerid,"Dead_World");
TogglePlayerControllable(playerid,false);
SetCameraBehindPlayer(playerid);
SetPlayerHealth(playerid,1.0);
ApplyAnimation(playerid, "PARACHUTE", "FALL_skyDive_DIE", 4.0, 0, 1, 1, 1, -1);
// Message saying you need to type /accept death or w/e you want.
}
}
// Accept death command //
// Do really whatever you want possibly SpawnPlayer(playerid);
SpawnPlayer(playerid);
SetPlayerHealth(playerid,50.0);
DeletePVar(playerid,"Dead");
Re: if a player dies.. -
maramizo - 22.02.2011
And ofcourse you SetPVarInt(playerid, "Dead", 0) in there after the /accept death.
Re: if a player dies.. -
FreshKilla - 22.02.2011
Quote:
Originally Posted by maramizo
And ofcourse you SetPVarInt(playerid, "Dead", 0) in there after the /accept death.
|
We'll i just did a simple example but Deleting the PVar would be better.
Re: if a player dies.. -
maramizo - 22.02.2011
Quote:
Originally Posted by FreshKilla
We'll i just did a simple example but Deleting the PVar would be better.
|
Yes it would be better, unless if you want to spawn dead everytime you login the server.