(HELP) After rest spawn
#1

Hello, i have problem, when i have rest and after rest I spawn again in bad, and must rest again and again, but i should spawn in front of hospital
look:
pawn Код:
if(FirstSpawn[playerid] != 1)
            {
                //new string[256];
                new cut = deathcost;
                SafeGivePlayerMoney(playerid, -cut);
                MedicBill[playerid] = 0;
                MedicTime[playerid] = 0;
                NeedMedicTime[playerid] = 0;
                SetPlayerToTeamColor(playerid);
                SetPlayerPos(playerid,1178.0300,-1323.4100,14.0999); // hospital spawn(there i wanna respawn)
                SetPlayerFacingAngle(playerid, 0);
                SetPlayerInterior(playerid,0);
                PlayerInfo[playerid][pInt] = 0;
                PlayerInfo[playerid][pDeaths] += 1;
                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 rest now ...", 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] = 30;
                }
                else
                {
                    NeedMedicTime[playerid] = 40;
                }
                PlayerPlaySound(playerid, 1062, 0.0, 0.0, 0.0);
       return 1;
   }
I should spawn in front of hospital, but I again spawn in Bad in hospital, why please? what's bad on this script?
Reply
#2

change coordinates
Reply
#3

Why, cahnge coordinates? I don't need change, it is correct, spawn infront of Hostpital, but I spawn again on bad and must wait next the time to be free, but when I should be free I respawn again on bad and again and again.
Reply
#4

You need to create a variable which tells if the player finished his rest, if so, he'll SetPlayerPos to your specific location. If you might notice, when you SetPlayerPos, under it, it sets it once again, only randomly to one of the bads inside the hospital.
Reply
#5

Thanks Eliran, you helped, again
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)