13.01.2016, 19:34
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:
Here are the timers:
Anything u found weird here ? I think everything is explained well so i hope u respond fast thanks
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) }
Код:
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; }