Jump to content

[REZOLVAT] Cerere textdraw “Next payday in: “


LVCAS
 Share

Recommended Posts

  • Username : joyyy
  • Problema întâlnită: as vrea textdraw-ul cu next payday in și sa se scurga minutele
  • Detalii despre problemă: -
  • Ce ai încercat să faci înainte să postezi?: sa fac acel textdraw dar nu știu cum sa pun sa scadă minutele
  • Cod sursa (recomandat pastebin.com) : -
  • Alte detalii : help me
Link to comment
Share on other sites

Pai ai zis "Ce ai încercat să faci înainte să postezi?: sa fac acel textdraw dar nu știu cum sa pun sa scadă minutele" inseamna ca ai acel TextDraw da tu nu stii cum sa faci sa scada secundele. Nici nu stii de ce ai nevoie.

 

Link to comment
Share on other sites

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];

 

Respecta si vei fi respectat.

 

BigInt Pawn:

Pacman C++: 

Snake C++:

Minesweeper C++:

 

mattbb.cash

leaks.ro

Link to comment
Share on other sites

La 29.12.2018 la 3:11, Matt a spus:

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];

 

Bun, voi incerca daca am vreo problema poate ma ajuti.. merci frumos bro.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...