04.09.2015, 03:52
(
Последний раз редактировалось Coringa_Vilao; 07.11.2015 в 04:32.
)
Resolvido !
#include <a_samp>
#include <zcmd>
#define ROUNDTEMPO 900000 // Tempo do round em segundos
new Text:RoundCount;
new roundtime;
new Segundos[MAX_PLAYERS];
new Minutos[MAX_PLAYERS];
new MS[MAX_PLAYERS];
public OnGameModeInit()
{
RoundCount = TextDrawCreate(270.000000, 397.000000, "_");
TextDrawBackgroundColor(RoundCount, 255);
TextDrawFont(RoundCount, 2);
TextDrawLetterSize(RoundCount, 0.500000, 2.199999);
TextDrawColor(RoundCount, -1);
TextDrawSetOutline(RoundCount, 1);
TextDrawSetProportional(RoundCount, 1);
return 1;
}
/* Comando */
CMD:iround(playerid) { return roundtime = SetTimerEx("RoundTime", 1000, 0, "d", playerid); }
forward RoundTime(playerid);
public RoundTime(playerid)
{
SetTimerEx("RoundCounter", 9, 1, "d", playerid);
MS[playerid] = 99;
Segundos[playerid] = ROUNDTEMPO;
TextDrawShowForAll(Text:RoundCount);
KillTimer(roundtime);
return 1;
}
forward RoundCounter(playerid);
public RoundCounter(playerid)
{
MS[playerid]--;
if(MS[playerid] == 0)
{
MS[playerid] = 99;
Segundos[playerid]--;
}
if(Segundos[playerid] > 60)
{
new Segundos2 = Segundos[playerid] - 60;
Segundos[playerid] = Segundos2;
Minutos[playerid]++;
}
if(Segundos[playerid] == 0 && Minutos[playerid] > 0)
{
Segundos[playerid] = 59;
Minutos[playerid]--;
}
if(Segundos[playerid] == 0 && MS[playerid] == 1)
{
TextDrawHideForAll(Text:RoundCount);
//terminou o round
KillTimer(roundtime);
}
if(Segundos[playerid] < 10)
{
new count[10];
format(count, sizeof(count), "00:0%i:%i", Segundos[playerid], MS[playerid]);
TextDrawSetString(RoundCount, count);
}
if(Segundos[playerid] >= 10)
{
new count[10];
format(count, sizeof(count), "00:%i:%i", Segundos[playerid], MS[playerid]);
TextDrawSetString(RoundCount, count);
}
if(Minutos[playerid] < 10 && Segundos[playerid] < 10)
{
new count[10];
format(count, sizeof(count), "0%i:0%i:%i",Minutos[playerid], Segundos[playerid], MS[playerid]);
TextDrawSetString(RoundCount, count);
}
if(Minutos[playerid] < 10 && Segundos[playerid] > 9)
{
new count[10];
format(count, sizeof(count), "0%i:%i:%i",Minutos[playerid], Segundos[playerid], MS[playerid]);
TextDrawSetString(RoundCount, count);
}
if(Minutos[playerid] >= 10 && Segundos[playerid] > 9)
{
new count[10];
format(count, sizeof(count), "%i:%i:%i",Minutos[playerid], Segundos[playerid], MS[playerid]);
TextDrawSetString(RoundCount, count);
}
if(Minutos[playerid] >= 10 && Segundos[playerid] < 10)
{
new count[10];
format(count, sizeof(count), "%i:0%i:%i",Minutos[playerid], Segundos[playerid], MS[playerid]);
TextDrawSetString(RoundCount, count);
}
return 1;
}