Pai, pentru inceput avem:
new minutes, seconds = PlayerVar[playerid][pPayday], str[128];
minutes = seconds / 60;
seconds -= minutes*60;
Asa vom calcula secundele si minutele. Apoi, pentru afisaj avem:
format(str, 128, "next_payday_in:_~g~%s%d:%s%d", (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds);
PlayerTextDrawSetString(playerid, PaydayPTD[playerid], str);
PlayerTextDrawShow(playerid, PaydayPTD[playerid]);
^^ Codul trebuie sa stea intr-un timer! Spre exemplu: (ai nevoie de y_timers pentru a folosi timer-ul de mai jos)
timer OneSecondTimer[1000]()
{
foreach(new playerid : Player) {
new minutes, seconds = PlayerVar[playerid][pPayday], str[128];
minutes = seconds / 60;
seconds -= minutes*60;
format(str, 128, "next_payday_in:_~g~%s%d:%s%d", (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds);
PlayerTextDrawSetString(playerid, PaydayPTD[playerid], str);
PlayerTextDrawShow(playerid, PaydayPTD[playerid]);
}
}
Si poti folosi textdraw-ul meu: (care trebuie pus in OnPlayerConnect)
PaydayPTD[playerid] = CreatePlayerTextDraw(playerid, 3.000001, 437.644470, "next_payday_in:_00:00");
PlayerTextDrawLetterSize(playerid, PaydayPTD[playerid], 0.199666, 1.056592);
PlayerTextDrawAlignment(playerid, PaydayPTD[playerid], 1);
PlayerTextDrawColor(playerid, PaydayPTD[playerid], -1);
PlayerTextDrawSetShadow(playerid, PaydayPTD[playerid], 0);
PlayerTextDrawSetOutline(playerid, PaydayPTD[playerid], 1);
PlayerTextDrawBackgroundColor(playerid, PaydayPTD[playerid], 255);
PlayerTextDrawFont(playerid, PaydayPTD[playerid], 2);
PlayerTextDrawSetProportional(playerid, PaydayPTD[playerid], 1);
Trebuie si el initializat la inceput:
new PlayerText:PaydayPTD[MAX_PLAYERS];