CMD:sethora(playerid, params[])
{
new time, Name[24], string[128];
if(PlayerInfo[playerid][pStaff] < 1) return SendClientMessage(playerid,0x16EB43FF,"Vocк nгo esta autorizado a usar este comando!");
GetPlayerName(playerid, Name, sizeof(Name));
if(sscanf(params, "i", time)) return SendClientMessage(playerid, -1, "USE: /sethora [hora 0-24]");
if(time > 24 || time < 0) return SendClientMessage(playerid, -1, "Erro: Hora invalida");
SetWorldTime(time);
format(string, 128, "{ff0000}Admin %s mudou o horario do servidor", Name);
SendClientMessageToAll(0xff00FF,string);
return 1;
}
Eu criei este comando para setar o horario em meu servidor, mas ele seta mais em menos de 2 segundos volta ao normal.
Ex: Esta de dia, dai vocк seta para as 24 hs, dai fica escuro mais em menos de 2s volta a ficar claro novamente. pawn Код:
|
public ProcessGameTime()
{
new string[128];
gettime(i_ServerHours, i_ServerMinutes, i_ServerSeconds);
getdate(i_ServerYears, i_ServerMonths, i_ServerDays);
format(string, sizeof string, "%02d:%02d:%02d", i_ServerHours, i_ServerMinutes, i_ServerSeconds);
TextDrawSetString(txtTimeDisp, string);
format(string, sizeof string, "%02d/%02d/%04d", i_ServerDays, i_ServerMonths, i_ServerYears);
TextDrawSetString(txtDateDisp, string);
SetWorldTime(i_ServerHours);
for(new i = 0; i < MAX_PLAYERS; i++)SetPlayerTime(i, i_ServerHours, i_ServerMinutes);
}
new bool:UsarHoraAuto;
new HoraSetada;
public OnGamemodeInit()
{
UsarHoraAuto = true;
HoraSetada = 0;
return true;
}
CMD:sethora(playerid, params[])
{
new time, Name[24], string[128];
if(PlayerInfo[playerid][pStaff] < 1) return SendClientMessage(playerid,0x16EB43FF,"Vocк nгo esta autorizado a usar este comando!");
GetPlayerName(playerid, Name, sizeof(Name));
if(sscanf(params, "i", time)) return SendClientMessage(playerid, -1, "USE: /sethora [hora 0-24, -1 = Padrгo]");
if(time > 24 || time < 0) return SendClientMessage(playerid, -1, "Erro: Hora invalida");
SetWorldTime(time);
format(string, 128, "{ff0000}Admin %s mudou o horario do servidor", Name);
SendClientMessageToAll(0xff00FF,string);
HoraSetada = time;
if(time != -1)
{
UsarHoraAuto = false;
}
else
{
UsarHoraAuto = true;
}
return 1;
}
public ProcessGameTime()
{
new string[128];
gettime(i_ServerHours, i_ServerMinutes, i_ServerSeconds);
getdate(i_ServerYears, i_ServerMonths, i_ServerDays);
format(string, sizeof string, "%02d:%02d:%02d", i_ServerHours, i_ServerMinutes, i_ServerSeconds);
TextDrawSetString(txtTimeDisp, string);
format(string, sizeof string, "%02d/%02d/%04d", i_ServerDays, i_ServerMonths, i_ServerYears);
TextDrawSetString(txtDateDisp, string);
if(UsarHoraAuto == true)
{
SetWorldTime(i_ServerHours);
for(new i = 0; i < MAX_PLAYERS; i++)SetPlayerTime(i, i_ServerHours, i_ServerMinutes);
}
else
{
SetWorldTime(HoraSetada);
for(new i = 0; i < MAX_PLAYERS; i++)SetPlayerTime(i, HoraSetada, 00);
}
}