Textdraw that shows time in jail LEFT. [REP ++]
#1

Hi. I have an arrest command, what sets you in jail for X seconds, depending on the amount of wanted stars you have. After X time when the timer stops, you get released from jail. But how do show the time left in textdraw? Waiting for your replies.
Reply
#2

Top
pawn Код:
new PlayerText:TextdrawBW2[MAX_PLAYERS];
Ones he goes to jail: (You might need to change playerid if you using an /arrest command)
pawn Код:
new bwstring[256];
            format(bwstring,sizeof(bwstring),"%d sec",/*here the time line eg. PlayerInfo[playerid][pJailTime]*/);
            TextdrawBW2[playerid] = CreatePlayerTextDraw(playerid, 571.000000, 431.000000, bwstring);
            PlayerTextDrawBackgroundColor(playerid, TextdrawBW2[playerid], 255);
            PlayerTextDrawFont(playerid, TextdrawBW2[playerid], 1);
            PlayerTextDrawLetterSize(playerid, TextdrawBW2[playerid], 0.500000, 1.000000);
            PlayerTextDrawColor(playerid, TextdrawBW2[playerid], -65281);
            PlayerTextDrawSetOutline(playerid, TextdrawBW2[playerid], 1);
            PlayerTextDrawSetProportional(playerid, TextdrawBW2[playerid], 1);
            PlayerTextDrawShow(playerid,  TextdrawBW2[playerid]);
Once he is free
pawn Код:
PlayerTextDrawHide(playa,TextdrawBW2[playerid]);
You need to use a timer to update the textdraw. in such way:

pawn Код:
forward Timer1(playerid);
public Timer1(playerid)
{
PlayerTextDrawHide(playa,TextdrawBW2[playerid]);
            new bwstring[256];
            format(bwstring,sizeof(bwstring),"%d sec",/*here the time line eg. PlayerInfo[playerid][pJailTime]*/);
            TextdrawBW2[playerid] = CreatePlayerTextDraw(playerid, 571.000000, 431.000000, bwstring);
            PlayerTextDrawBackgroundColor(playerid, TextdrawBW2[playerid], 255);
            PlayerTextDrawFont(playerid, TextdrawBW2[playerid], 1);
            PlayerTextDrawLetterSize(playerid, TextdrawBW2[playerid], 0.500000, 1.000000);
            PlayerTextDrawColor(playerid, TextdrawBW2[playerid], -65281);
            PlayerTextDrawSetOutline(playerid, TextdrawBW2[playerid], 1);
            PlayerTextDrawSetProportional(playerid, TextdrawBW2[playerid], 1);
            PlayerTextDrawShow(playerid,  TextdrawBW2[playerid]);
}

SetTimerEx("Timer1", 1000, 1, "d", playerid);
KillTimer(Timer1[playerid]);

then kill timer when he is out
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)