SA-MP Forums Archive
Loop or Settimer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Loop or Settimer (/showthread.php?tid=504487)



Loop or Settimer - NEXT0LIFE0RP - 04.04.2014

Ca anyone help me or tell me where and how to set a loop or timer here.

Код:
ptask EMSUpdate[5000](playerid)
{
    if(GetPVarType(playerid, "Injured"))
    {
        if(GetPVarInt(playerid, "EMSAttempt") != 0)
                {
 
                        new Float:health;
                        GetPlayerHealth(playerid,health);
                        SetPlayerHealth(playerid, health-1);
                        if(GetPVarInt(playerid, "EMSAttempt") == -1)
                        {
                                if(GetPlayerAnimationIndex(playerid) != 746) ClearAnimations(playerid), ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.0, 0, 1, 1, 1, 0, 1);
                                GameTextForPlayer(playerid, "~r~Injured~n~~w~/service ems", 5000, 3);
                        }
                        if(GetPVarInt(playerid, "EMSAttempt") == 1)
                        {
                                if(GetPlayerAnimationIndex(playerid) != 746) ClearAnimations(playerid), ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.0, 0, 1, 1, 1, 0, 1);
                                GameTextForPlayer(playerid, "~r~Injured~n~~w~Waiting for EMS to Arrive...", 5000, 3);
                        }
                        if(GetPVarInt(playerid, "EMSAttempt") == 2)
                        {
                        GameTextForPlayer(playerid, "~g~Rescued~n~~w~Awaiting Treatment...", 5000, 3);
                        }
                        if(GetPVarInt(playerid, "EMSAttempt") == 3)
                        {
                        if(IsPlayerInAnyVehicle(playerid))
                        {
                                new ambmodel = GetPlayerVehicleID(playerid);
                                if(IsAnAmbulance(ambmodel) || IsATierraESCar(ambmodel))
                                {
                                        GameTextForPlayer(playerid, "~g~Rescued~n~~w~Waiting for EMS to take to Hospital...", 5000, 3);
                                        }
                                        else
                                        {
                                        SendClientMessageEx(playerid, COLOR_WHITE, "You fell unconscious due to no life support, you were immediately sent to the hospital.");
                                        KillEMSQueue(playerid);
                                                SpawnPlayer(playerid);
                                                TogglePlayerBurning(playerid, false);
                                        }
                                }
                                else
                                {
                                SendClientMessageEx(playerid, COLOR_WHITE, "You fell out of the vehicle, the Paramedics will have to try harder.");
                                }
                        }
 
                        GetPlayerHealth(playerid, health);
                        if(health <= 5)
                        {
                        SendClientMessageEx(playerid, COLOR_WHITE, "You fell unconscious, you were immediately sent to the hospital.");
                        KillEMSQueue(playerid);
                                SpawnPlayer(playerid);
                                TogglePlayerBurning(playerid, false);
                        }
        }
    }
}



Re : Loop or Settimer - S4t3K - 04.04.2014

I simply not read the whole code.

Explain with more words what do you wanna do "here" to need a loop or a timer.