SorinDivoiu Posted February 7, 2019 Share Posted February 7, 2019 (edited) Username: SennoProblema întălnită: TIMER.Detalii despre problemă:Deci, eu vreau sa fac un timer pentru fiecare jucator si nu-mi iese, as vrea sa fac un sistem ca pe ruby (cel cu stupii), si dupa cum stiti ei au un timer mic intr-un colt si-ti spune exact cate minute mai sunt pana iti poti ridica mierea. Un timer din acesta as vrea si eu. Sistemul este gata, doar timer-ul mai am sa-l fac si habar n-am cum.Ce ai încercat să faci înainte să postezi?: Incerc de aseara sa-i tot dau de cap si nu pot.Cod sursă (recomandat pastebin.com) :https://pastebin.com/2Vbfj7a5Alte detalii: Am pus pChestie si 'mesaj' deoarece sunt unii 'scripteri' si dupa spun ca e ideea lor originala. Edited February 7, 2019 by SorinDivoiu Link to comment Share on other sites More sharing options...
qRuby. Posted February 7, 2019 Share Posted February 7, 2019 (edited) Foloseste-te de YSI Timers (y_timers). ptask UpdateTime[1000](playerid) { foreach(Player, i) { new Str[34]; TimeS --; if(PlayerInfo[playerid][pChestie] == 1) { if(TimeM == 0 && TimeS == 0) { PlayerInfo[playerid][pChestie] = 0; SendClientMessage(playerid, -1, "mesaj"); PlayerTextDrawDestroy(playerid, Textdraw0); KillTimer(Time); } if(TimeS == -1) { TimeM--; TimeS = 59; } if(TimeS<10) { format(Str, sizeof(Str), "%d:0%d", TimeM, TimeS); } if(TimeS>9) { format(Str, sizeof(Str), "%d:%d", TimeM, TimeS); } } } return 1; } P.S: cand a facut prima tura sa se porneasca timer-ul prin "defer UpdateTime(playerid);" Edited February 7, 2019 by qRuby. SorinDivoiu 1 Link to comment Share on other sites More sharing options...
SorinDivoiu Posted February 7, 2019 Author Share Posted February 7, 2019 1 oră în urmă, qRuby. a spus: Foloseste-te de YSI Timers (y_timers). ptask UpdateTime[1000](playerid) { foreach(Player, i) { new Str[34]; TimeS --; if(PlayerInfo[playerid][pChestie] == 1) { if(TimeM == 0 && TimeS == 0) { PlayerInfo[playerid][pChestie] = 0; SendClientMessage(playerid, -1, "mesaj"); PlayerTextDrawDestroy(playerid, Textdraw0); KillTimer(Time); } if(TimeS == -1) { TimeM--; TimeS = 59; } if(TimeS<10) { format(Str, sizeof(Str), "%d:0%d", TimeM, TimeS); } if(TimeS>9) { format(Str, sizeof(Str), "%d:%d", TimeM, TimeS); } } } return 1; } P.S: cand a facut prima tura sa se porneasca timer-ul prin "defer UpdateTime(playerid);" Mersi de ajutor, o sa incerc chiar acum. Link to comment Share on other sites More sharing options...
Administrator Leonard Posted February 7, 2019 Administrator Share Posted February 7, 2019 De ce ai face un foreach intr-un timer per player? ... nu-i logic ca e apelat la fiecare jucator in parte? Pentru a face un timer mai usor, foloseste-te de libraria YSI, mai exact de include-ul y_timers. ptask onPlayerSecondTimer[ 1000 ]( playerid ) { // your code return true; } Matt 1 www.liberty.mp Link to comment Share on other sites More sharing options...
Matt Posted February 7, 2019 Share Posted February 7, 2019 Acum 5 ore, qRuby. a spus: Foloseste-te de YSI Timers (y_timers). ptask UpdateTime[1000](playerid) { foreach(Player, i) { new Str[34]; TimeS --; if(PlayerInfo[playerid][pChestie] == 1) { if(TimeM == 0 && TimeS == 0) { PlayerInfo[playerid][pChestie] = 0; SendClientMessage(playerid, -1, "mesaj"); PlayerTextDrawDestroy(playerid, Textdraw0); KillTimer(Time); } if(TimeS == -1) { TimeM--; TimeS = 59; } if(TimeS<10) { format(Str, sizeof(Str), "%d:0%d", TimeM, TimeS); } if(TimeS>9) { format(Str, sizeof(Str), "%d:%d", TimeM, TimeS); } } } return 1; } P.S: cand a facut prima tura sa se porneasca timer-ul prin "defer UpdateTime(playerid);" Aici ai creat un timer care pentru fiecare player va executa un loop prin toti playerii. @SorinDivoiu foloseste exemplul lui Leonard. Respecta si vei fi respectat. BigInt Pawn: Pacman C++: Snake C++: Minesweeper C++: mattbb.cash leaks.ro Link to comment Share on other sites More sharing options...
Administrator keNN. Posted February 7, 2019 Administrator Share Posted February 7, 2019 (edited) Acum 5 ore, qRuby. a spus: Foloseste-te de YSI Timers (y_timers). ptask UpdateTime[1000](playerid) { foreach(Player, i) { new Str[34]; TimeS --; if(PlayerInfo[playerid][pChestie] == 1) { if(TimeM == 0 && TimeS == 0) { PlayerInfo[playerid][pChestie] = 0; SendClientMessage(playerid, -1, "mesaj"); PlayerTextDrawDestroy(playerid, Textdraw0); KillTimer(Time); } if(TimeS == -1) { TimeM--; TimeS = 59; } if(TimeS<10) { format(Str, sizeof(Str), "%d:0%d", TimeM, TimeS); } if(TimeS>9) { format(Str, sizeof(Str), "%d:%d", TimeM, TimeS); } } } return 1; } P.S: cand a facut prima tura sa se porneasca timer-ul prin "defer UpdateTime(playerid);" Bravo coaie. Edited February 7, 2019 by Leonard =)))))))))))))))))))))))))))))))) Fresh, Matt and Leonard 3 Te-ai inregistrat? Ne-ar placea sa te prezinti. Alatura-te grupului nostru de Discord. Link to comment Share on other sites More sharing options...
SorinDivoiu Posted February 7, 2019 Author Share Posted February 7, 2019 Multumesc de ajutor, am rezolvat problema. Link to comment Share on other sites More sharing options...
Administrator Leonard Posted February 8, 2019 Administrator Share Posted February 8, 2019 Problema a fost rezolvată. Topic închis! www.liberty.mp Link to comment Share on other sites More sharing options...
Recommended Posts