SA-MP Forums Archive
Not showing Jail - 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: Not showing Jail (/showthread.php?tid=436104)



Not showing Jail - DerickClark - 10.05.2013

not showing jail textdraw.

Код:
// This is the timer that runs for every player who's in jail
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)
		SpawnPlayer(playerid);
		// Also, kill the jailtimer
		KillTimer(APlayerData[playerid][PlayerJailedTimer]);
	}
	else
	{
		// Show the remaining jailtime (only if the remaining time is below 60 seconds)
		if (APlayerData[playerid][PlayerJailed] < 60)
		{
			format(JailMsg, 20, TXT_JailTimer, APlayerData[playerid][PlayerJailed]);
			new  RouteText[55];
			format(RouteText, 55, "%s", JailMsg, " ");
			TextDrawSetString(APlayerData[playerid][MissionText], RouteText);
			//GameTextForPlayer(playerid, JailMsg, 750, 4);
		}
		// Decrease the jailtime by 1 second
        APlayerData[playerid][PlayerJailed] = APlayerData[playerid][PlayerJailed] - 1;
	}
}
Define
Код:
#define TXT_JailTimer "~w~Time Remaining: ~r~%i~w~"
it only show time remaining when it is under 60 seconds left, even if you edit it
Код:
// Show the remaining jailtime (only if the remaining time is below 60 seconds)
		if (APlayerData[playerid][PlayerJailed] < 60)



Re: Not showing Jail - mineralo - 10.05.2013

you can't just define it
Код:
#define TXT_JailTimer "~w~Time Remaining: ~r~%i~w~"
use normal
pawn Код:
format(JailMsg, 20, "~w~Time Remaining: ~r~%i~w~", APlayerData[playerid][PlayerJailed]);



Re: Not showing Jail - [HiC]TheKiller - 10.05.2013

Quote:
Originally Posted by mineralo
Посмотреть сообщение
you can't just define it
Код:
#define TXT_JailTimer "~w~Time Remaining: ~r~%i~w~"
use normal
pawn Код:
format(JailMsg, 20, "~w~Time Remaining: ~r~%i~w~", APlayerData[playerid][PlayerJailed]);
I don't see any problem with using the define.

If it's not showing the textdraw at all, then you may not have originally used TextDrawShowForPlayer. Also, change the timer code to

pawn Код:
public UnjailPlayer(playerid)
{
    new JailMsg[20];
    if (APlayerData[playerid][PlayerJailed] == 0)
    {
        SetPlayerVirtualWorld(playerid, 0);
        SetPlayerInterior(playerid, 0);
        SpawnPlayer(playerid);
        KillTimer(APlayerData[playerid][PlayerJailedTimer]);
    }
    else
    {
        if (APlayerData[playerid][PlayerJailed] < 60)
        {
            format(JailMsg, 20, TXT_JailTimer, APlayerData[playerid][PlayerJailed]);
            TextDrawSetString(APlayerData[playerid][MissionText], JailMsg);
        }
                APlayerData[playerid][PlayerJailed] --;
    }
        return 1;
}
See if that helps.


Re: Not showing Jail - DerickClark - 10.05.2013

But it don't show the textdraw it go blank.

it show the textdraw box.


Edit:
It work but don't show the time


Код:
// This is the timer that runs for every player who's in jail
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)
		SpawnPlayer(playerid);
		// Also, kill the jailtimer
		KillTimer(APlayerData[playerid][PlayerJailedTimer]);
	}
	else
	{
		// Show the remaining jailtime (only if the remaining time is below 60 seconds)
		if (APlayerData[playerid][PlayerJailed] < 60)
		{
			format(JailMsg, 20, "%s~w~Time Remaining:~r~%i~w~", APlayerData[playerid][PlayerJailed]);
			new RouteText[255];
            format(RouteText, 255, "%s", JailMsg, " ");
			TextDrawSetString(APlayerData[playerid][MissionText], RouteText);
			//GameTextForPlayer(playerid, JailMsg, 750, 4);
		}
		// Decrease the jailtime by 1 second
        APlayerData[playerid][PlayerJailed] = APlayerData[playerid][PlayerJailed] - 1;
	}
}