26.12.2018, 18:04
PHP код:
new JailTimer[MAX_PLAYERS];
time[targetid] = 60; //Time (60 seconds -> 1 minute)
JailTimer[targetid] = SetTimerEx("TimeOut", 1000, true, "i", targetid);
forward TimeOut(playerid)
public TimeOut(playerid);
{
time[playerid] -= 1;
if(time[playerid] <= 0)
{
if(IsPlayerConnected(playerid))
{
time[playerid] = 0;
KillTimer(JailTimer[playerid]);
SendClientMessage(playerid, -1, "You have left prison");
return 1;
}
}
new str[24]; format(str, sizeof str, "Time:_%d", TimeConvert(time[playerid]));
GameTextForPlayer(playerid, str, 2000, 3);
return 1;
}
TimeConvert(seconds)
{
new tmp[16];
new minutes = floatround(seconds/60);
seconds -= minutes*60;
format(tmp, sizeof(tmp), "%d:%02d", minutes, seconds);
return tmp;
}