Hey I have HUGELY renovated an old game mode, but I can't fix the death bug. When you go to the hospital you always stay there, forever, and never leave. Here is the code, hope someone can help me with whats wrong!
Code:
if(MedicBill[playerid] == 1 && PlayerInfo[playerid][pJailed] == 0 && PlayerPaintballing[playerid] == 0)
{
if(FirstSpawn[playerid] != 1)
{
/*new string[256];
new cut = deathcost; //PlayerInfo[playerid][pLevel]*deathcost;
SafeGivePlayerMoney(playerid, -cut);
format(string, sizeof(string), "DOC: Your Medical Bill comes to $%d, Have a nice day.", cut);
SendClientMessage(playerid, TEAM_CYAN_COLOR, string);
MedicBill[playerid] = 0;
MedicTime[playerid] = 0;
NeedMedicTime[playerid] = 0;*/
PlayerInfo[playerid][pDeaths] += 1;
SetPlayerHealth(playerid, 100.0);
SetPlayerInterior(playerid, 3);
PlayerInfo[playerid][pInt] = 3;
rand = random(sizeof(gMedicSpawns));
SetPlayerPos(playerid, gMedicSpawns[rand][0], gMedicSpawns[rand][1], gMedicSpawns[rand][2]); // Warp the player
SetPlayerFacingAngle(playerid, 0);
TogglePlayerControllable(playerid, 0);
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~You need to take some time and recover.", 30000, 3);
JustDied[playerid] = 1;
MedicTime[playerid] = 1;
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
if(PlayerInfo[playerid][pDonateRank] > 0)
{
NeedMedicTime[playerid] = 10;
}
else
{
NeedMedicTime[playerid] = 10;
}
PlayerPlaySound(playerid, 1062, 0.0, 0.0, 0.0);
return 1;
}
}
if(JustDied[playerid] == 1)
{
if(GetPlayerVirtualWorld(playerid) != 0 || PlayerInfo[playerid][pVirWorld] != 0)
{
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pVirWorld] = 0;
}
SetPlayerPos(playerid, 1182.5638,-1323.5256,13.5790);
SetPlayerFacingAngle(playerid, 270.0);
SetPlayerInterior(playerid,0);
PlayerInfo[playerid][pInt] = 0;
return 1;
}
if(PlayerInfo[playerid][pCrashed] == 1)
{
if(TutTime[playerid] == 0 && PlayerInfo[playerid][pTut] == 1 && RegistrationStep[playerid] == 0 && AfterTutorial[playerid] == 0 && FirstSpawn[playerid] == 1)
{
SetPlayerVirtualWorld(playerid,PlayerInfo[playerid][pVirWorld]);
SetPlayerInterior(playerid,PlayerInfo[playerid][pInt]);
SetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z] + 1);
//SendClientMessage(playerid, COLOR_WHITE, "Crashed, returning to your last location.");
//GameTextForPlayer(playerid, "~p~Crashed~n~~w~returning to your last location", 5000, 1);
return 1;
}
}
if(house !=255)
{
if(SpawnChange[playerid]) //If 1, house spawn, else spawn other local.
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid,HouseInfo[house][hInt]);
SetPlayerVirtualWorld(playerid,HouseInfo[house][hWorld]);
SetPlayerPos(playerid, HouseInfo[house][hExitx], HouseInfo[house][hExity],HouseInfo[house][hExitz]); // Warp the player
PlayerInfo[playerid][pLocal] = house;
HouseEntered[playerid] = house;
PlayerInfo[playerid][pInt] = HouseInfo[house][hInt];
return 1;
}
}
if(PlayerInfo[playerid][pLeader] == 7)//Mayor spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid, 3);
SetPlayerPos(playerid, 356.2998,151.9914,1025.7891);
PlayerInfo[playerid][pInt] = 3;
PlayerInfo[playerid][pLocal] = 241;
return 1;
}
if (PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)//Police Force spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid,6);
rand = random(sizeof(gCopPlayerSpawns));
SetPlayerPos(playerid, gCopPlayerSpawns[rand][0], gCopPlayerSpawns[rand][1], gCopPlayerSpawns[rand][2]); // Warp the player
SetPlayerFacingAngle(playerid, 270.0);
PlayerInfo[playerid][pInt] = 6;
return 1;
}
if (PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)//FBI spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid, 299.7097,183.1322,1007.1719);
SetPlayerFacingAngle(playerid, 90);
PlayerInfo[playerid][pInt] = 3;
return 1;
}
if (PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)//army spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 2731.5229,-2451.3643,17.5937);
PlayerInfo[playerid][pInt] = 0;
return 1;
}
if (PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)//LSFMD spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerPos(playerid, 1180.2388,-1331.6196,1006.4028);
SetPlayerInterior(playerid,6);
SetPlayerFacingAngle(playerid, 0);
PlayerInfo[playerid][pInt] = 6;
return 1;
}
if (PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5)//Hazmat spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid, 18);
SetPlayerPos(playerid, 1302.519897,-1.787510,1001.028259);
PlayerInfo[playerid][pInt] = 18;
return 1;
}
if (PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)//La Famiglia Sinatra spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid, 5);
SetPlayerPos(playerid, 1265.4475,-794.9257,1084.0078);
PlayerInfo[playerid][pInt] = 5;
return 1;
}
if (PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8) //Hitman spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerPos(playerid, 1102.7017,-299.0774,73.9922);
SetPlayerInterior(playerid,0);
PlayerInfo[playerid][pInt] = 0;
return 1;
}
if (PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9) //SAN News spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid, 355.7899,204.0173,1008.3828);
PlayerInfo[playerid][pInt] = 3;
SafeGivePlayerWeapon(playerid, 43, 20);
return 1;
}
if (PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10) //Taxi Cab Co spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerPos(playerid, 1754.99,-1894.19,13.55);
SetPlayerInterior(playerid,0);
PlayerInfo[playerid][pInt] = 0;
return 1;
}
/*if (PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14)//Yamaguchi spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid, 1);
SetPlayerPos(playerid, -779.6406,501.2036,1371.7422);
PlayerInfo[playerid][pInt] = 1;
return 1;
}
*/
if (PlayerInfo[playerid][pMember] == 15 || PlayerInfo[playerid][pLeader] == 15)//Vatos Locos spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid, 3);
SetPlayerPos(playerid, 2495.2605,-1703.7449,1018.3438);
PlayerInfo[playerid][pInt] = 3;
return 1;
}
if (PlayerInfo[playerid][pMember] == 16 || PlayerInfo[playerid][pLeader] == 16)//Bloods spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid, 2);
SetPlayerPos(playerid, 455.8776,1413.6802,1084.3080);
PlayerInfo[playerid][pInt] = 2;
return 1;
}
if(IsAnInstructor(playerid) || PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pLeader] == 11) //DMV and licenses School spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid, 1494.4991,1308.9163,1093.2845);
SetPlayerFacingAngle(playerid, 180);
PlayerInfo[playerid][pInt] = 3;
return 1;
}
if ((gTeam[playerid]) == 1)
{
SetPlayerToTeamColor(playerid);
rand = random(sizeof(gMedPlayerSpawns));
SetPlayerPos(playerid, gMedPlayerSpawns[rand][0], gMedPlayerSpawns[rand][1], gMedPlayerSpawns[rand][2]); // Warp the player
SetPlayerFacingAngle(playerid, 270.0);
SetPlayerInterior(playerid,0);
PlayerInfo[playerid][pInt] = 0;
return 1;
}
/*if(PlayerInfo[playerid][pFMember] != 255)
{
new family = PlayerInfo[playerid][pFMember];
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid, FamilyInfo[family][FamilyInterior]);
SetPlayerPos(playerid, FamilyInfo[family][FamilySpawn][0],FamilyInfo[family][FamilySpawn][1],FamilyInfo[family][FamilySpawn][2]);
SetPlayerFacingAngle(playerid, FamilyInfo[family][FamilySpawn][3]);
return 1;
}*/
else
{
SetPlayerToTeamColor(playerid);
SetPlayerPos(playerid,1612.3240,-2330.1670,13.5469);
SetPlayerFacingAngle(playerid, 0);
SetPlayerInterior(playerid,0);
PlayerInfo[playerid][pInt] = 0;
return 1;
}
}
return 1;
}
great, not helpful however.
Your using LA-RP Right?, i had this bug too, Search new cut; and goto the second one, should look like this:
Thanks much! It works perfectly, with the exception of the textdraw. The text saying "you need to rest" that stays when you go back in. However I can fix that.
Scratch that. Its perfect, works 100% thanks man.