18.10.2009, 11:30
I made a textdraw, that counts the remaining jail time for the players. It works good, but when you are moving, it writes bad numbers. I tried to make this from Kye's clock.
Counting:
On player gets jailed:
OnGameModeInit:
Counting:
pawn Код:
public UpdateJailTime(playerid)
{
format(jailtimestr,32,"%d",PlayerInfo[playerid][pJailTime]);
TextDrawSetString(txtJailTimeDisp,jailtimestr);
}
pawn Код:
TextDrawShowForPlayer(playerid,txtJailTimeDisp);
UpdateJailTime(playerid);
SetTimerEx("UpdateJailTime", 1000, 1, "i", playerid);
pawn Код:
txtJailTimeDisp = TextDrawCreate(605.0,40.0,"00");
TextDrawUseBox(txtJailTimeDisp, 0);
TextDrawFont(txtJailTimeDisp, 3);
TextDrawSetShadow(txtJailTimeDisp,0); // no shadow
TextDrawSetOutline(txtJailTimeDisp,2); // thickness 1
TextDrawBackgroundColor(txtJailTimeDisp,0x000000FF);
TextDrawColor(txtJailTimeDisp,COLOR_LIGHTRED);
TextDrawAlignment(txtJailTimeDisp,3);
TextDrawLetterSize(txtJailTimeDisp,0.5,1.5);