Count Down Timer - 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: Count Down Timer (
/showthread.php?tid=585647)
Count Down Timer -
DerickClark - 15.08.2015
Can i add a mission failed function into this code? when 10 is done the mission is failed.
Код:
StopPlayerJob(playerid);
Код:
forward TruckCheck(playerid);
public TruckCheck(playerid)
{
if (IsPlayerInAnyVehicle(playerid) == 0)
{
//GameTextForPlayer(playerid, "Get back in your TRUCK!~n~Or Reconnect your trailer!~n~[30]", 1000, 4);
//In the script:
const time = 10; //This would be 10sec
GameTextForPlayer(playerid,!"Get back in your TRUCK!~n~Or Reconnect your trailer!~n~[10]",1000,5);
@countdown(playerid,time);
return 1;
}
else if (IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) == 0)
{
GameTextForPlayer(playerid, "Reconnect your trailer!", 1000, 5);
return 1;
}
return 0;
}
Код:
@countdown(playerid,x);@countdown(playerid,x)
{
if(--x == 0) return GameTextForPlayer(playerid,!"Mission Failed!",1000,5);
new str[8];
valstr(str,x);
GameTextForPlayer(playerid,str,1000,5);
return SetTimerEx(!"@countdown",999,0,!"ii",playerid,x);
}