OnPlayerDeath
#1

Ok I made a death system for an rp server, what it does is on OnPlayerDeath it checks what level you are, if your level is less then 3 you don't get charged anything, after that you will be "in the hospital" for 3 minutes, but I wan't to know is it possible to get rid of the thing at the bottom of the screen with the arrows and the spawn button.




Here is the code

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(PlayerInfo[playerid][pLevel] <= 3)
    {
        SetPlayerPos(playerid, 2002.3518, -1447.4727, 8.0220);
        SetPlayerCameraLookAt(playerid, 2033.5793, -1402.8020, 17.8498);
        TogglePlayerControllable(playerid, 0);
        SendClientMessage(playerid, 0xFC3F3FAA, " You have been rushed to the emergency room! you will spend some time here while you recover ((3 minutes)) ");
        SendClientMessage(playerid, 0xFC3F3FAA, " Due to being lower then level 3 your hospital bills were payed by the state!");
        SetTimer("dtimer", 180000, false);
    }
    else
    {
        SetPlayerPos(playerid, 2002.3518, -1447.4727, 8.0220);
        SetPlayerCameraLookAt(playerid, 2033.5793, -1402.8020, 17.8498);
        TogglePlayerControllable(playerid, 0);
        SendClientMessage(playerid, 0xFC3F3FAA, " You have been rushed to the emergency room! you will spend some time here while you recover ((3 minutes)) ");
        SendClientMessage(playerid, 0xFC3F3FAA, " You will be charged 450 dollars for your trip to the hospital");
        SetTimer("dtimer", 180000, false);
    }
    return 1;
}
forward dtimer(playerid);
public dtimer(playerid)
{
    SendClientMessage(playerid, 0xFC3F3FAA, " Yoou have been discharged from the hospital please remember you have lost thirty minutes of your memory");
    SendClientMessage(playerid, 0xFCF3FAA, " including who killed you! If you Revenge Kill you will be prisoned");
    SetPlayerPos(playerid, 2033.4850,-1404.9219,17.2470);
    SetCameraBehindPlayer(playerid);
    SpawnPlayer(playerid);
    TogglePlayerControllable(playerid, 1);
}
Reply
#2

You need to SpawnPlayer(playerid); then TogglePlayerControllable(playerid, 0) - this will freeze the player. After the timer make TogglePlayerControllable(playerid, 1).
Reply
#3

Thank you I am going to try it now.
Reply
#4

OnPlayerDeath
{
Dead[playerid] = true;
}

OnPlayerSpawn
{
if(Dead[playerid] == true)
{
TogglePlayerSpectating(playerid, true);
//The rest of ur code with camera position and timer...
}
}

//Add TogglePlayerSpectating(playerid, false); into your death timer function.
Reply
#5

Got it working thanks for your help Jhnz +rep
Reply
#6

Thank you .

Need more help? PM me.
Reply
#7

Sounds like you are punishing your players for having high levels.

You'll find SetSpawnInfo useful too for this type of thing you want to do.
Reply
#8

Why in the world would you use SetSpawnInfo?
Reply
#9

Quote:
Originally Posted by clavador
Посмотреть сообщение
Sounds like you are punishing your players for having high levels.

You'll find SetSpawnInfo useful too for this type of thing you want to do.
No, I am giving new players a chance to earn money before giving them death bills.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)