27.12.2013, 06:30
Hi,
My jail's timer was showing on GameText so i changed it to Textdraw and working fine. But the problem is, the timer only starts decreasing when you set 99 seconds, if an admin jail a player for more than 100 seconds, the timer doesn't start decrease, it looks like it is frozen. So i want to make it with minutes and seconds. For example: 02:59 how do i do this?
Code
My jail's timer was showing on GameText so i changed it to Textdraw and working fine. But the problem is, the timer only starts decreasing when you set 99 seconds, if an admin jail a player for more than 100 seconds, the timer doesn't start decrease, it looks like it is frozen. So i want to make it with minutes and seconds. For example: 02:59 how do i do this?
Code
pawn Код:
forward UnjailPlayer(playerid);
public UnjailPlayer(playerid)
{
new JailMsg[20];
// Check if the player is allowed to leave yet
if (APlayerData[playerid][PlayerJailed] == 0)
{
// Set the player in the normal world
SetPlayerVirtualWorld(playerid, 0);
// Set player interior to the outside
SetPlayerInterior(playerid, 0);
// Put the player outside the jail (he should spawn at the location where he spawned after login or after choosing a rescue-point)
SetPlayerPos(playerid, 1551.8965,-1675.5037,16.0512);
SendClientMessage(playerid, 0x00CE00FF, "You have been released from the jail!");
// Also, kill the jailtimer
TextDrawHideForPlayer(playerid, JTD[playerid]);
KillTimer(APlayerData[playerid][PlayerJailedTimer]);
}
else
{
// Show the remaining jailtime (only if the remaining time is below 60 seconds)
if (APlayerData[playerid][PlayerJailed] < 300)
{
format(JailMsg, 20, TXT_JailTimer, APlayerData[playerid][PlayerJailed]);
TextDrawSetString(JTD[playerid], JailMsg);
TextDrawShowForPlayer(playerid, JTD[playerid]);
}
// Decrease the jailtime by 1 second
APlayerData[playerid][PlayerJailed] = APlayerData[playerid][PlayerJailed] - 1;
}
}