Death Timer scripting Help please - 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: Death Timer scripting Help please (
/showthread.php?tid=571769)
Death Timer scripting Help please -
shaquill - 22.04.2015
Okay so Im trying to figure out how to set the timer for when you get shot you re-spawn in that location and wait for EMS to come treat you.. Right now the EMS/FD is working but the only problem is when someone kill you, You spawn in the hospital right away.. How do i set the timer so you have time to wait for EMS/FD before bleeding out.
Here is my code i think.. i think this what i need to change :/
Код:
if(MedicTime[playerid] > 0)
{
if(MedicTime[playerid] == 3)
{
SetPlayerInterior(playerid, 5);
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X,Y,Z);
SetPlayerCameraPos(playerid, X + 3, Y, Z);
SetPlayerCameraLookAt(playerid,X,Y,Z);
}
MedicTime[playerid] ++;
if(MedicTime[playerid] >= NeedMedicTime[playerid])
{
new cut = deathcost; //PlayerInfo[playerid][pLevel]*deathcost;
GivePlayerCash(playerid, -cut);
format(string, sizeof(string), "Hospital: Your medical bill comes to $%d, have a nice day.", cut);
SendClientMessageEx(playerid, TEAM_CYAN_COLOR, string);
TogglePlayerControllable(playerid, 1);
SetPVarInt(playerid, "MedicBill", 0);
MedicTime[playerid] = 0;
NeedMedicTime[playerid] = 0;
SpawnPlayer(playerid);
}
}
Im new to scripting!
P.S This my first post so Sorry in advance if i posted in the wrong format..
Re: Death Timer scripting Help please -
ChuckyBabe - 22.04.2015
This might help you.
https://sampwiki.blast.hk/wiki/SetTimer
Re: Death Timer scripting Help please -
shaquill - 22.04.2015
Thanks for the fast reply, Im very new to scripting and just learning how to edit.. After reading the link you have me i still have no idea what to change, Would this have anything to do with it ?
Код:
else if(type == TYPE_HOSPITALTIMER)
{
if(GetPVarInt(playerid, "HospitalTimer") > 0)
{
new Float:curhealth;
GetPlayerHealth(playerid, curhealth);
SetPVarInt(playerid, "HospitalTimer", GetPVarInt(playerid, "HospitalTimer")-1);
SetPlayerHealth(playerid, curhealth+1);
SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_HOSPITALTIMER);
if(GetPVarInt(playerid, "HospitalTimer") == 0)
{
HospitalSpawn(playerid);
Re: Death Timer scripting Help please -
BrianSan - 22.04.2015
Код:
SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_HOSPITALTIMER);
Try changing it from false to true, see if that works.
Re: Death Timer scripting Help please -
shaquill - 22.04.2015
Quote:
Originally Posted by BrianSan
Код:
SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_HOSPITALTIMER);
Try changing it from false to true, see if that works.
|
I think the true and false is for if you want the timer to keep repeating or not.. But ill try anyway aha