Not showing Jail
#1

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)
Reply
#2

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]);
Reply
#3

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.
Reply
#4

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;
	}
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)