if a player dies..
#1

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
Reply
#2

More like PR RP?
Reply
#3

Yeah, or LS-RP.
Reply
#4

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");
Reply
#5

And ofcourse you SetPVarInt(playerid, "Dead", 0) in there after the /accept death.
Reply
#6

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)