Need help with hospital spawn
#7

Quote:
Originally Posted by ColweeN
View Post
Hello,

@Crayder here are my codes.

public OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid, 2616.5447,2453.2605,14.8672);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
SetPlayerPos(playerid, 10.2967,148.8675,999.0613);
SetPlayerHealth(playerid, 100);
GivePlayerMoney(playerid, -500);
SendClientMessage(playerid, -1,"DOCTOR: You have paid your medical bill.");
return 1;
}
You are ultimately spawning the player on the spawn zone on this callback
PHP Code:
public OnPlayerSpawn(playerid)
{
    
SetPlayerPos(playerid2616.5447,2453.2605,14.8672);
    return 
1;

You can use a variable, when player death variable = 1, if variable = 1 spawn player to hospital


add this on the top of the script, under includes
PHP Code:
new Hospitalized[MAX_PLAYERS]; 
Then, OnPlayerDeath
PHP Code:
public OnPlayerDeath(playeridkilleridreason)
{
    
Hospitalized[playerid] = 1;
    
SetPlayerPos(playerid10.2967,148.8675,999.0613);
    
SetPlayerHealth(playerid100);
    
GivePlayerMoney(playerid, -500);
    
SendClientMessage(playerid, -1,"DOCTOR: You have paid your medical bill.");
    return 
1;

and OnPlayerSpawn will be like this
PHP Code:
public OnPlayerSpawn(playerid)
{
    if(
Hospitalized[playerid]){
        
SetPlayerPos(playerid10.2967,148.8675,999.0613);
    }else{
        
SetPlayerPos(playerid2616.5447,2453.2605,14.8672);
     }
    return 
1;

Hope it will work
Reply


Messages In This Thread
Need help with hospital spawn - by ColweeN - 29.03.2019, 01:59
Re: Need help with hospital spawn - by Crayder - 29.03.2019, 02:24
Re: Need help with hospital spawn - by ColweeN - 29.03.2019, 02:28
Re: Need help with hospital spawn - by MSC - 29.03.2019, 02:36
Re: Need help with hospital spawn - by Crayder - 29.03.2019, 03:20
Re: Need help with hospital spawn - by ColweeN - 29.03.2019, 07:08
Re: Need help with hospital spawn - by akib - 29.03.2019, 08:12
Re: Need help with hospital spawn - by ColweeN - 29.03.2019, 08:36

Forum Jump:


Users browsing this thread: 1 Guest(s)