Not spawning at hospital?
#1

So hey now my friend did something like when u die u spawn at a random position ( on bed ) in hospital and onplayerdeath he is assigning PlayerInfo[playerid][pHospital] = 1; and PlayerInfo[playerid][pHospitalTime] = 180; hospital time is the time he is gonna spend in hospital before he gets released i hope thats clear enough.
So now onplayerspawn i have this:
Код:
	if(PlayerInfo[playerid][pHospital] == 1)
        {
        new rand;
		rand = random(sizeof(gLeganjeMD));
		SetPlayerPos(playerid, gLeganjeMD[rand][0], gLeganjeMD[rand][1], gLeganjeMD[rand][2]);
		SetPlayerInterior(playerid, 0);
		PlayerInfo[playerid][pInt] = 0;
		SendClientMessage(playerid, C_RED, "{CFCB08}You have been moved to hospital cuz u ded m8.");
		SetPlayerSkin(playerid, 62);
		TogglePlayerControllable(playerid, 0);
		SetTimerEx("TeleportTimer", 2000, false, "d", playerid);
		bolnicatimer[playerid] = SetTimerEx("BolnicaTimerce", 1000, true, "d", playerid);
		SetTimerEx("BolnicaLeganjeTimer", 2010, false, "d", playerid);
		SetPlayerFacingAngle(playerid, 360);
		} 
if(PlayerInfo[playerid][pHospital] == 0)
{
... There i put some other stuff for normal spawn position( like textdraw shows for example)
}
Here are the timers:
Код:
forward TeleportTimer(playerid);
public TeleportTimer(playerid)
{
	TogglePlayerControllable(playerid, 1);
}

//------------------------------------------------------------------------------

forward BolnicaLeganjeTimer(playerid);
public BolnicaLeganjeTimer(playerid)
{
	ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
 	SetTimerEx("AnimacijaBolnica", 15000, false, "d", playerid);
}

//------------------------------------------------------------------------------

forward BolnicaTimerce(playerid);
public BolnicaTimerce(playerid)
{
    if(PlayerInfo[playerid][pHospital] == 1)
 	{
		if(PlayerInfo[playerid][pHospitalTime] >= 1)
		{
			PlayerInfo[playerid][pHospitalTime] -= 1;
			return 1;
		}
		else if(PlayerInfo[playerid][pHospitalTime] == 0)
		{
			new string[126];
			new string1[126];
			new medicbill = 100*PlayerInfo[playerid][pLevel];
			PlayerInfo[playerid][pHospitalTime] = 0;
			PlayerInfo[playerid][pHospital] = 0;
			SendClientMessage(playerid, C_GRAD1,"{739EFA}Doktor: {FFFFFF}You can go now m8 hospital isnt a place for u anymore.");
			OdzemiPari(playerid, medicbill);
			format(string1, sizeof(string1), "{739EFA}Doktor: {FFFFFF}Your bill is: $%d.",medicbill);
			SendClientMessage(playerid, C_BLCRVENA,string1);
			format(string, sizeof(string), "~g~YOU ARE READY TO GO!");
			GameTextForPlayer(playerid, string, 5000, 1);
			SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
			TogglePlayerControllable(playerid, 1);
			KillTimer(bolnicatimer[playerid]);
			SpawnPlayer( playerid  );
		}
 	}
	return 1;
}
Anything u found weird here ? I think everything is explained well so i hope u respond fast thanks
Reply


Messages In This Thread
Not spawning at hospital? - by bugi - 13.01.2016, 19:34
Re: Not spawning at hospital? - by N0FeaR - 13.01.2016, 20:22
Re: Not spawning at hospital? - by Joron - 13.01.2016, 20:31
Re: Not spawning at hospital? - by bugi - 13.01.2016, 20:31
Re: Not spawning at hospital? - by bugi - 13.01.2016, 20:39
Respuesta: Not spawning at hospital? - by IzadorO - 13.01.2016, 21:06
Re: Not spawning at hospital? - by Kathleen - 13.01.2016, 21:12
Respuesta: Re: Not spawning at hospital? - by IzadorO - 13.01.2016, 21:19
Re: Not spawning at hospital? - by bugi - 13.01.2016, 21:25
Respuesta: Re: Not spawning at hospital? - by IzadorO - 13.01.2016, 22:46

Forum Jump:


Users browsing this thread: 1 Guest(s)