Need help to add minutes in jail timer. -
iOxide - 27.12.2013
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
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;
}
}
Re: Need help to add minutes in jail timer. -
ToiletDuck - 27.12.2013
There i hope you can understand my explanation im not good in explanation :S
pawn Код:
if (APlayerData[playerid][PlayerJailed] <= 300) // Less than Equal to 300 it means 300 to 1 is counted if you use '<' 300 -- Less than it says 299 - 1 300 its not counted
{
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]--;
Re: Need help to add minutes in jail timer. -
iOxide - 27.12.2013
That didn't work, still same problem. The timer looks like frozen when you set more than 100 seconds. And when the timer reach 99, it start to decrease.
Re: Need help to add minutes in jail timer. -
ToiletDuck - 27.12.2013
this should be fixed
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]);
APlayerData[playerid][PlayerJailed] = 0;
}
else
{
// Show the remaining jailtime (only if the remaining time is below 60 seconds)
if (APlayerData[playerid][PlayerJailed] > 0)
{
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]--;
}
}
Re: Need help to add minutes in jail timer. -
iOxide - 27.12.2013
Nope, still the same problem :/
Re: Need help to add minutes in jail timer. -
iOxide - 27.12.2013
/Bump
Please someone help me! Its urgent. :/