Don't get teleported to hospital after dieing - 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: Don't get teleported to hospital after dieing (
/showthread.php?tid=456571)
Don't get teleported to hospital after dieing -
Sellize - 06.08.2013
So when I type /kill I just respawn normally without getting taken to the hospital first
And yes my pSpawn value is 1
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(PlayerInfo[playerid][pSpawn] == 1 || PlayerInfo[playerid][pSpawn] == 4)
{
SetPVarInt(playerid, "hospitalls", 1);
}
return 1;
}
Код:
public OnPlayerSpawn(playerid)
{
if(GetPVarInt(playerid, "hospitalls") == 1)
{
SetPVarInt(playerid, "hospitalls", 0);
SetPlayerPos(playerid, 1176.90, -1323.50, 14.04);
ResetPlayerWeapons(playerid);
SendClientMessage(playerid, -1, "You have immediately been sent to the All Saints General hospital after you had been found dead.");
if(GetPlayerMoney(playerid) < 2500)
{
SendClientMessage(playerid, -1, "The doctors have taken away your weapons and since you could not pay the {1AE888}$2500 {FFFFFF}bill you have been spawned with less health.");
SetPlayerHealth(playerid, 25.0);
}
else
{
GivePlayerMoney(playerid, -2500);
SendClientMessage(playerid, -1, "The doctors have taken away your weapons and have charged you {1AE888}$2500 {FFFFFF}for their work.");
SetPlayerHealth(playerid, 60.0);
}
}
return 1;
}
Re: Don't get teleported to hospital after dieing -
ThePhenix - 06.08.2013
PHP код:
PlayerInfo[playerid][pSpawn] == 1 || PlayerInfo[playerid][pSpawn] == 4
When are you setting a value to them?
PHP код:
Here's an example, in which just admins won't get teleported.
public OnPlayerDeath(playerid, killerid, reason)
{
if(!IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] < 1)
{
SetPVarInt(playerid, "hospitalls", 1);
}
return 1;
}
Re: Don't get teleported to hospital after dieing -
Sellize - 07.08.2013
In the dialog he can set his pSpawn value
PHP код:
if(dialogid == DIALOG_SPAWNPOINT)
{
if(response)
{
switch(listitem)
{
case 0: // LS
{
SendClientMessage(playerid, -1, "You will spawn in Los Santos the next time you spawn.");
PlayerInfo[playerid][pSpawn] = 1;
}
case 1: // LV
{
SendClientMessage(playerid, -1, "You will spawn in Las Venturas the next time you spawn.");
PlayerInfo[playerid][pSpawn] = 2;
}
case 2: // SF
{
SendClientMessage(playerid, -1, "You will spawn in San Fierro the next time you spawn.");
PlayerInfo[playerid][pSpawn] = 3;
}
case 3: // PC
{
SendClientMessage(playerid, -1, "You will spawn in Palomino Creek the next time you spawn.");
PlayerInfo[playerid][pSpawn] = 4;
}
}
}
}
Re: Don't get teleported to hospital after dieing -
Sellize - 07.08.2013
Help me please