21.03.2012, 15:35
No meu GM aquele reloginho do GTA ta desativado!
Como Faзo para reativar?
Como Faзo para reativar?
#include <a_samp>
static i_ServerSeconds;
static i_ServerMinutes;
static i_ServerHours;
static i_ServerDays;
static i_ServerMonths;
static i_ServerYears;
new Text:txtTimeDisp;
new Text:txtDateDisp;
forward ProcessGameTime();
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);}
}
public OnFilterScriptInit()
{
txtTimeDisp = TextDrawCreate(632.0,25.0,"--:--:--");
TextDrawUseBox(txtTimeDisp, 0);
TextDrawFont(txtTimeDisp, 3);
TextDrawSetShadow(txtTimeDisp,0);
TextDrawSetOutline(txtTimeDisp,2);
TextDrawBackgroundColor(txtTimeDisp,0x000000FF);
TextDrawColor(txtTimeDisp,0xFFFFFFFF);
TextDrawAlignment(txtTimeDisp,3);
TextDrawLetterSize(txtTimeDisp,0.5,1.5);
txtDateDisp = TextDrawCreate(620.0,5.0,"00/00/0000");
TextDrawUseBox(txtDateDisp, 0);
TextDrawFont(txtDateDisp, 3);
TextDrawSetShadow(txtDateDisp,0);
TextDrawSetOutline(txtDateDisp,2);
TextDrawBackgroundColor(txtDateDisp,0x000000FF);
TextDrawColor(txtDateDisp,0xFFFFFFFF);
TextDrawAlignment(txtDateDisp,3);
TextDrawLetterSize(txtDateDisp,0.5,1.5);
ProcessGameTime();
SetTimer("ProcessGameTime", 1000, 1);
return 1;
}
public OnFilterScriptExit()
{
TextDrawHideForAll(txtTimeDisp);
TextDrawDestroy(txtTimeDisp);
TextDrawHideForAll(txtDateDisp);
TextDrawDestroy(txtDateDisp);
return 1;
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid,txtTimeDisp);
TextDrawShowForPlayer(playerid,txtDateDisp);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
TextDrawHideForPlayer(playerid,txtTimeDisp);
TextDrawHideForPlayer(playerid,txtDateDisp);
return 1;
}
if (strcmp(cmdtext, "/dia", true) == 0)
{
SendClientMessage(playerid, COR, "Tempo alterado para Dia!");
SetPlayerTime(playerid, 12, 0);
return 1;
}
if (strcmp(cmdtext, "/tarde", true) == 0)
{
SendClientMessage(playerid, COR, "Tempo alterado para Tarde!");
SetPlayerTime(playerid, 6, 0);
return 1;
}
if (strcmp(cmdtext, "/noite", true) == 0)
{
SendClientMessage(playerid, COR, "Tempo alterado para Noite!");
SetPlayerTime(playerid, 0, 0);
return 1;
}
//==================Topo
forward Relogio();
new Text:Relogio1;
new Text:Relogio2;
//================OnPlayerSpawn
TextDrawHideForAll(Relogio1);
TextDrawShowForPlayer(playerid, Relogio1);
TextDrawHideForAll(Relogio2);
TextDrawShowForPlayer(playerid, Relogio2);
//================OnGameModeInit
SetTimer("relogio",1000,true);
//=Ainda na OnGameModeInit
Relogio1 = TextDrawCreate(525.000000,4.000000,"--");
Relogio2 = TextDrawCreate(550.000000,23.000000,"--");
TextDrawAlignment(Relogio1,0);
TextDrawAlignment(Relogio2,0);
TextDrawBackgroundColor(Relogio1,0x000000FF);
TextDrawBackgroundColor(Relogio2,0x000000FF);
TextDrawFont(Relogio1,3);
TextDrawLetterSize(Relogio1,0.499999,2.155555);
TextDrawFont(Relogio2,3);
TextDrawLetterSize(Relogio2,0.499999,2.155555);
TextDrawSetProportional(Relogio1,1);
TextDrawSetProportional(Relogio2,1);
TextDrawSetShadow(Relogio1,1);
TextDrawSetShadow(Relogio2,1);
TextDrawSetOutline(Relogio1,1);
TextDrawSetOutline(Relogio2,1);
TextDrawShowForAll(Relogio1);
TextDrawShowForAll(Relogio2);
//============OnGameModeExit
TextDrawDestroy(Relogio1);
TextDrawDestroy(Relogio2);
TextDrawHideForAll(Relogio1);
TextDrawHideForAll(Relogio2);
//============= Em algum lugar '-'
public Relogio(){
SyncTime();
new
string[256],
ano,
mes,
dia,
horas,
minutos,
segundos;
getdate(ano, mes, dia);gettime(horas, minutos, segundos);
format(string, sizeof string, "~b~~h~~h~~h~%d/%s%d/2012", dia, ((mes < 10) ? ("0") : ("")), mes);TextDrawSetString(Relogio1, string);
format(string, sizeof string, "~b~~h~~h~~h~%s%d:%s%d:%s%d", (horas < 10) ? ("0") : (""), horas, (minutos < 10) ? ("0") : (""), minutos, (segundos < 10) ? ("0") : (""), segundos);TextDrawSetString(Relogio2, string);
TextDrawShowForAll(Relogio1);TextDrawShowForAll(Relogio2);}