Don't get teleported to hospital after dieing
#1

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

PHP код:
PlayerInfo[playerid][pSpawn] == || PlayerInfo[playerid][pSpawn] == 
When are you setting a value to them?


PHP код:
Here's an example, in which just admins won't get teleported.
public 
OnPlayerDeath(playeridkilleridreason)
{
    if(!
IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] < 1)
    {
        
SetPVarInt(playerid"hospitalls"1);
    }
    return 
1;

Reply
#3

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;
                }
            }
        }
    } 
Reply
#4

Help me please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)