OnPlayerDeath - 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)
+--- Thread: OnPlayerDeath (
/showthread.php?tid=320638)
OnPlayerDeath -
new121 - 23.02.2012
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);
}
Re: OnPlayerDeath -
JhnzRep - 23.02.2012
You need to SpawnPlayer(playerid); then TogglePlayerControllable(playerid, 0) - this will freeze the player. After the timer make TogglePlayerControllable(playerid, 1).
Re: OnPlayerDeath -
new121 - 23.02.2012
Thank you I am going to try it now.
Re: OnPlayerDeath -
Audiophr3ak - 24.02.2012
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.
Re: OnPlayerDeath -
new121 - 24.02.2012
Got it working thanks for your help Jhnz +rep
Re: OnPlayerDeath -
JhnzRep - 24.02.2012
Thank you
.
Need more help? PM me.
Re: OnPlayerDeath -
clavador - 24.02.2012
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.
Re: OnPlayerDeath -
JhnzRep - 24.02.2012
Why in the world would you use SetSpawnInfo?
Re: OnPlayerDeath -
new121 - 24.02.2012
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.