[Ajuda] com 1 relogio
#1

Relogio que o Lux criou, MUITO bem feito por sinal, sу que assim, ele pega pela hora do PC que hospeda pelo oque parece pois testei agora e estava 00:01, e onde hospedo meu servidor nгo й a hora certa pelo oque parece, tem como adpatar para esse relogio pegar a hora REAL em tempo REAL sem ser do prуpio pc? aqui o cуdigo
pawn Код:
/*
                                     Copyrightњ ® LuxurioN™
________________________________________________________________________________________________
  _                                                          _               _ _       _
 | |                                                        |_|             |   \     | |
 | |                       _       _               _ _ _     _    _ _ _ _   | |\ \    | |
 | |           | |   | |  | |     | |  | |   | |  |  _  \   | |  |  _ _  |  | | \ \   | |
 | |           | |   | |   | |   | |   | |   | |  | |_| /   | |  | |   | |  | |  \ \  | |
 | |           | |   | |    | | | |    | |   | |  |  _ \    | |  | |   | |  | |   \ \ | |
 | |_ _ _ _ _  | |_ _| |   | |   | |   | |_ _| |  | | \ \   | |  | |_ _| |  | |    \ \| |
 |_ _ _ _ _ _| |_ _ _ _|  |_|     |_|  |_ _ _ _|  |_|  \_|  |_|  |_ _ _ _|  |_|     \_ _|

________________________________________________________________________________________________
                             .:: Do not remove the Credits ::.



                                 **************************
                             LuX TDC (The Digital Clock)  v1.0
                                 **************************
*/


#include <a_samp>

#define GREEN           0x21DD00FF
#define RED             0xE60000FF
#define YELLOW          0xFFFF00FF
#define ORANGE          0xF97804FF
#define LIGHTRED        0xFF8080FF
#define LIGHTBLUE       0x00C2ECFF
#define PURPLE          0xB360FDFF
#define BLUE            0x1229FAFF
#define LIGHTGREEN      0x38FF06FF
#define DARKPINK        0xE100E1FF
#define DARKGREEN       0x008040FF
#define ANNOUNCEMENT    0x6AF7E1FF
#define GREY            0xCECECEFF
#define PINK            0xD52DFFFF
#define DARKGREY        0x626262FF
#define AQUAGREEN       0x03D687FF
#define WHITE           0xFFFFFFFF

new Tstring[12][2];
new DelTime;

new Text: LuxClock_Center;
new Text: LuxClock[12];
new Text: LText1;
new Text: LText2;
new Text: LText3;
new Text: LText4;
new Text: LText5;
new Text: LText6;
new Text: LText7;
new Text: LHour;
new Text: LInfo;
new Text: LCategory;
new Text: LMonth;
new Text: LDay;
new Text: LMsg;

forward L_UpdateTime (playerid);
forward L_UpdateClock();


public OnFilterScriptInit()
{

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// -> Clock Functions <-
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
LHour = TextDrawCreate(493.000000,411.000000,"  ");
TextDrawAlignment(LHour,0);
TextDrawBackgroundColor(LHour,0x000000ff);
TextDrawFont(LHour,1);
TextDrawLetterSize(LHour,0.399999,1.000000);
TextDrawColor(LHour,0xffffffff);
TextDrawSetOutline(LHour,1);
TextDrawSetProportional(LHour,1);
TextDrawSetShadow(LHour,1);

LInfo = TextDrawCreate(555.000000,357.000000,"Relogio Digital");
TextDrawAlignment(LInfo,0);
TextDrawBackgroundColor(LInfo,0x000000ff);
TextDrawFont(LInfo,1);
TextDrawLetterSize(LInfo,0.299999,1.000000);
TextDrawColor(LInfo,0xffffff66);
TextDrawSetOutline(LInfo,1);
TextDrawSetProportional(LInfo,1);
TextDrawSetShadow(LInfo,1);

LCategory = TextDrawCreate(567.000000,369.000000,"Informaзгo");
TextDrawAlignment(LCategory,0);
TextDrawBackgroundColor(LCategory,0x000000ff);
TextDrawFont(LCategory,1);
TextDrawLetterSize(LCategory,0.199999,0.899999);
TextDrawColor(LCategory,0xffffffff);
TextDrawSetOutline(LCategory,1);
TextDrawSetProportional(LCategory,1);
TextDrawSetShadow(LCategory,1);

LMonth = TextDrawCreate(550.000000,385.000000,"  ");
TextDrawAlignment(LMonth,0);
TextDrawBackgroundColor(LMonth,0x000000ff);
TextDrawFont(LMonth,1);
TextDrawLetterSize(LMonth,0.199999,0.899999);
TextDrawColor(LMonth,0xffffffff);
TextDrawSetOutline(LMonth,1);
TextDrawSetProportional(LMonth,1);
TextDrawSetShadow(LMonth,1);

LDay = TextDrawCreate(551.000000,396.000000,"  ");
TextDrawAlignment(LDay,0);
TextDrawBackgroundColor(LDay,0x000000ff);
TextDrawFont(LDay,1);
TextDrawLetterSize(LDay,0.199999,1.000000);
TextDrawColor(LDay,0xffffffff);
TextDrawSetOutline(LDay,1);
TextDrawSetProportional(LDay,1);
TextDrawSetShadow(LDay,1);

LMsg = TextDrawCreate(552.000000,413.000000," ");
TextDrawAlignment(LMsg,0);
TextDrawBackgroundColor(LMsg,0x000000ff);
TextDrawFont(LMsg,1);
TextDrawLetterSize(LMsg,0.199999,0.899999);
TextDrawColor(LMsg,0xffffffff);
TextDrawSetOutline(LMsg,1);
TextDrawSetProportional(LMsg,1);
TextDrawSetShadow(LMsg,1);

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// -> Background Desing <-
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

LText1 = TextDrawCreate(635.000000,352.000000,"TB");
LText2 = TextDrawCreate(485.000000,352.000000,"L");
LText3 = TextDrawCreate(632.000000,352.000000,"T");
LText4 = TextDrawCreate(633.000000,428.000000,"T");
LText5 = TextDrawCreate(546.000000,356.000000,"T2");
LText6 = TextDrawCreate(546.000000,410.000000,"T2");
LText7 = TextDrawCreate(631.000000,356.000000,"TB");

TextDrawUseBox(   LText1,1);
TextDrawBoxColor(LText1,0x00000099);
TextDrawTextSize(LText1,625.000000,0.000000);

TextDrawUseBox(   LText2,1);
TextDrawBoxColor( LText2,0x00000099);
TextDrawTextSize( LText2,475.000000,0.000000);

TextDrawUseBox(   LText3,1);
TextDrawBoxColor( LText3,0x00000099);
TextDrawTextSize( LText3,479.000000,0.000000);

TextDrawUseBox(   LText4,1);
TextDrawBoxColor( LText4,0x00000099);
TextDrawTextSize( LText4,478.000000,0.000000);

TextDrawUseBox(   LText5,1);
TextDrawBoxColor( LText5,0x00000066);
TextDrawTextSize( LText5,480.000000,0.000000);

TextDrawUseBox(   LText6,1);
TextDrawBoxColor( LText6,0x00000066);
TextDrawTextSize( LText6,480.000000,0.000000);

TextDrawUseBox(   LText7,1);
TextDrawBoxColor( LText7,0x00000066);
TextDrawTextSize( LText7,541.000000,0.000000);

TextDrawAlignment( LText1,0);
TextDrawAlignment( LText2,0);
TextDrawAlignment( LText3,0);
TextDrawAlignment( LText4,0);
TextDrawAlignment( LText5,0);
TextDrawAlignment( LText6,0);
TextDrawAlignment( LText7,0);

TextDrawBackgroundColor( LText1,0x000000ff);
TextDrawBackgroundColor( LText2,0x000000ff);
TextDrawBackgroundColor( LText3,0x000000ff);
TextDrawBackgroundColor( LText4,0x000000ff);
TextDrawBackgroundColor( LText5,0x000000ff);
TextDrawBackgroundColor( LText6,0x000000ff);
TextDrawBackgroundColor( LText7,0x000000ff);

TextDrawFont(LText1,3);
TextDrawLetterSize(LText1,-0.000000,8.199998);
TextDrawFont(LText2,3);
TextDrawLetterSize(LText2,-0.000000,8.200001);
TextDrawFont(LText3,3);
TextDrawLetterSize(LText3,-0.000000,-0.300000);
TextDrawFont(LText4,3);
TextDrawLetterSize(LText4,-0.000000,-0.200000);
TextDrawFont(LText5,3);
TextDrawLetterSize(LText5,-0.000000,5.300001);
TextDrawFont(LText6,3);
TextDrawLetterSize(LText6,-0.000000,1.300000);
TextDrawFont(LText7,3);
TextDrawLetterSize(LText7,-0.000000,7.299998);

TextDrawColor( LText1,0xffffffff);
TextDrawColor( LText2,0xffffffff);
TextDrawColor( LText3,0xffffffff);
TextDrawColor( LText4,0xffffffff);
TextDrawColor( LText5,0xffffffff);
TextDrawColor( LText6,0xffffffff);
TextDrawColor( LText7,0xffffffff);

TextDrawSetOutline( LText1,1);
TextDrawSetOutline( LText2,1);
TextDrawSetOutline( LText3,1);
TextDrawSetOutline( LText4,1);
TextDrawSetOutline( LText5,1);
TextDrawSetOutline( LText6,1);
TextDrawSetOutline( LText7,1);

TextDrawSetProportional( LText1,1);
TextDrawSetProportional( LText2,1);
TextDrawSetProportional( LText3,1);
TextDrawSetProportional( LText4,1);
TextDrawSetProportional( LText5,1);
TextDrawSetProportional( LText6,1);
TextDrawSetProportional( LText7,1);

TextDrawSetShadow( LText1,1);
TextDrawSetShadow( LText2,1);
TextDrawSetShadow( LText3,1);
TextDrawSetShadow( LText4,1);
TextDrawSetShadow( LText5,1);
TextDrawSetShadow( LText6,1);
TextDrawSetShadow( LText7,1);

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// -> Hours Desing <-
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

LuxClock_Center = TextDrawCreate(510.000000,373.000000,"o");
TextDrawAlignment(LuxClock_Center,0);
TextDrawFont(LuxClock_Center,1);
TextDrawLetterSize(LuxClock_Center,0.399999,1.200000);
TextDrawColor(LuxClock_Center,0xffffff66);
TextDrawSetOutline(LuxClock_Center,1);
TextDrawSetProportional(LuxClock_Center,1);
TextDrawSetShadow(LuxClock_Center,1);
TextDrawSetShadow(LuxClock_Center,1);

LuxClock[0] = TextDrawCreate(521.000000,359.000000,"~w~1");
TextDrawAlignment(LuxClock[0],0);
TextDrawBackgroundColor(LuxClock[0],0x000000ff);
TextDrawFont(LuxClock[0],1);
TextDrawLetterSize(LuxClock[0],0.399999,1.000000);
TextDrawColor(LuxClock[0],0xffffffff);
TextDrawSetOutline(LuxClock[0],1);
TextDrawSetProportional(LuxClock[0],1);
TextDrawSetShadow(LuxClock[0],1);

LuxClock[1] = TextDrawCreate(528.000000,368.000000,"~w~2");
TextDrawAlignment(LuxClock[1],0);
TextDrawBackgroundColor(LuxClock[1],0x000000ff);
TextDrawFont(LuxClock[1],1);
TextDrawLetterSize(LuxClock[1],0.299999,0.899999);
TextDrawColor(LuxClock[1],0xffffffff);
TextDrawSetOutline(LuxClock[1],1);
TextDrawSetProportional(LuxClock[1],1);
TextDrawSetShadow(LuxClock[1],1);

LuxClock[2] = TextDrawCreate(532.000000,377.000000,"~w~3");
TextDrawAlignment(LuxClock[2],0);
TextDrawBackgroundColor(LuxClock[2],0x000000ff);
TextDrawFont(LuxClock[2],1);
TextDrawLetterSize(LuxClock[2],0.299999,0.899999);
TextDrawColor(LuxClock[2],0xffffffff);
TextDrawSetOutline(LuxClock[2],1);
TextDrawSetProportional(LuxClock[2],1);
TextDrawSetShadow(LuxClock[2],1);

LuxClock[3] = TextDrawCreate(529.000000,386.000000,"~w~4");
TextDrawAlignment(LuxClock[3],0);
TextDrawBackgroundColor(LuxClock[3],0x000000ff);
TextDrawFont(LuxClock[3],1);
TextDrawLetterSize(LuxClock[3],0.299999,0.899999);
TextDrawColor(LuxClock[3],0xffffffff);
TextDrawSetOutline(LuxClock[3],1);
TextDrawSetProportional(LuxClock[3],1);
TextDrawSetShadow(LuxClock[3],1);

LuxClock[4] = TextDrawCreate(523.000000,394.000000,"~w~5");
TextDrawAlignment(LuxClock[4],0);
TextDrawBackgroundColor(LuxClock[4],0x000000ff);
TextDrawFont(LuxClock[4],1);
TextDrawLetterSize(LuxClock[4],0.299999,0.899999);
TextDrawColor(LuxClock[4],0xffffffff);
TextDrawSetOutline(LuxClock[4],1);
TextDrawSetProportional(LuxClock[4],1);
TextDrawSetShadow(LuxClock[4],1);

LuxClock[5] = TextDrawCreate(511.000000,397.000000,"~w~6");
TextDrawAlignment(LuxClock[5],0);
TextDrawBackgroundColor(LuxClock[5],0x000000ff);
TextDrawFont(LuxClock[5],1);
TextDrawLetterSize(LuxClock[5],0.299999,0.899999);
TextDrawColor(LuxClock[5],0xffffffff);
TextDrawSetOutline(LuxClock[5],1);
TextDrawSetProportional(LuxClock[5],1);
TextDrawSetShadow(LuxClock[5],1);

LuxClock[6] = TextDrawCreate(503.000000,394.000000,"~w~7");
TextDrawAlignment(LuxClock[6],0);
TextDrawBackgroundColor(LuxClock[6],0x000000ff);
TextDrawFont(LuxClock[6],1);
TextDrawLetterSize(LuxClock[6],0.199999,0.899999);
TextDrawColor(LuxClock[6],0xffffffff);
TextDrawSetOutline(LuxClock[6],1);
TextDrawSetProportional(LuxClock[6],1);
TextDrawSetShadow(LuxClock[6],1);

LuxClock[7] = TextDrawCreate(494.000000,387.000000,"~w~8");
TextDrawAlignment(LuxClock[7],0);
TextDrawBackgroundColor(LuxClock[7],0x000000ff);
TextDrawFont(LuxClock[7],1);
TextDrawLetterSize(LuxClock[7],0.299999,0.899999);
TextDrawColor(LuxClock[7],0xffffffff);
TextDrawSetOutline(LuxClock[7],1);
TextDrawSetProportional(LuxClock[7],1);
TextDrawSetShadow(LuxClock[7],1);

LuxClock[8] = TextDrawCreate(489.000000,378.000000,"~w~9");
TextDrawAlignment(LuxClock[8],0);
TextDrawBackgroundColor(LuxClock[8],0x000000ff);
TextDrawFont(LuxClock[8],1);
TextDrawLetterSize(LuxClock[8],0.199999,0.899999);
TextDrawColor(LuxClock[8],0xffffffff);
TextDrawSetOutline(LuxClock[8],1);
TextDrawSetProportional(LuxClock[8],1);
TextDrawSetShadow(LuxClock[8],1);

LuxClock[9] = TextDrawCreate(490.000000,368.000000,"~w~10");
TextDrawAlignment(LuxClock[9],0);
TextDrawBackgroundColor(LuxClock[9],0x000000ff);
TextDrawFont(LuxClock[9],1);
TextDrawLetterSize(LuxClock[9],0.199999,0.899999);
TextDrawColor(LuxClock[9],0xffffffff);
TextDrawSetOutline(LuxClock[9],1);
TextDrawSetProportional(LuxClock[9],1);
TextDrawSetShadow(LuxClock[9],1);

LuxClock[10] = TextDrawCreate(498.000000,359.000000,"~w~11");
TextDrawAlignment(LuxClock[10],0);
TextDrawBackgroundColor(LuxClock[10],0x000000ff);
TextDrawFont(LuxClock[10],1);
TextDrawLetterSize(LuxClock[10],0.199999,0.899999);
TextDrawColor(LuxClock[10],0xffffffff);
TextDrawSetOutline(LuxClock[10],1);
TextDrawSetProportional(LuxClock[10],1);
TextDrawSetShadow(LuxClock[10],1);

LuxClock[11] = TextDrawCreate(508.000000,356.000000,"~w~12");
TextDrawAlignment(LuxClock[11],0);
TextDrawBackgroundColor(LuxClock[11],0x000000ff);
TextDrawFont(LuxClock[11],1);
TextDrawLetterSize(LuxClock[11],0.299999,0.899999);
TextDrawColor(LuxClock[11],0xffffffff);
TextDrawSetOutline(LuxClock[11],1);
TextDrawSetProportional(LuxClock[11],1);
TextDrawSetShadow(LuxClock[11],1);

for(new t; t < 12; t++) format(Tstring[t], sizeof Tstring, "%d", t+1);
   
new Hour, Min, Second;

gettime(Hour, Min, Second);

if (Hour > 12) Hour -= 12;
if (Hour == 0) Hour = 12;

DelTime = Hour-1;

L_UpdateClock();

SetTimer("L_UpdateClock",60000,1);
SetTimer("L_UpdateTime" ,1000, 1);

print( "\n");
print( " **********************************");
print( " *                                *");
print( " *        ---------------         *");
print( " *         -> LuX TDC <-          *");
print( " *        ---------------         *");
print( " *     The Digital Clock v1.0     *");
print( " *          By LuxurioN           *");
print( " *                                *");
print( " **********************************");
print("\n");
return 1;
}

public OnFilterScriptExit()
{
    TextDrawDestroy(LuxClock_Center);
    TextDrawDestroy(LText1);
    TextDrawDestroy(LText2);
    TextDrawDestroy(LText3);
    TextDrawDestroy(LText4);
    TextDrawDestroy(LText5);
    TextDrawDestroy(LText6);
    TextDrawDestroy(LText7);
   
    TextDrawDestroy(LHour);
    TextDrawDestroy(LDay);
    TextDrawDestroy(LMonth);
    TextDrawDestroy(LInfo);
    TextDrawDestroy(LCategory);
    TextDrawDestroy(LMsg);

    for(new t; t < 12; t++) TextDrawDestroy(LuxClock[t]);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    L_UpdateClock();
    return 1;
}

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// -> Update Clock Functions <-
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
public L_UpdateTime(playerid)
{
    new string[256];
    new Hour, Minute, Second;
    new Year, Month, Day;
    gettime(Hour,Minute,Second);
    getdate(Year, Month, Day);
    format(string, sizeof(string), "%02d:%02d", Hour,Minute);
    TextDrawSetString(LHour, string);
    format(string, sizeof(string), "Dia: %02d (%02d/%d/%d)", Day,Day, Month, Year);
    TextDrawSetString(LDay, string);

    if(Month == 1){
    format(string, sizeof(string), "Mes: Janeiro");
    TextDrawSetString(LMonth, string);
    }
    else if(Month == 2)
    {
    format(string, sizeof(string), "Mes: Fevereiro");
    TextDrawSetString(LMonth, string);
    }
    else if(Month == 3){
    format(string, sizeof(string), "Mes: Marзo");
    TextDrawSetString(LMonth, string);
    }
    else if(Month == 4){
    format(string, sizeof(string), "Mes: Abril");
    TextDrawSetString(LMonth, string);
    }
    else if(Month == 5){
    format(string, sizeof(string), "Mes: Maio");
    TextDrawSetString(LMonth, string);
    }
    else if(Month == 6){
    format(string, sizeof(string), "Mes: Junho");
    TextDrawSetString(LMonth, string);
    }
    else if(Month == 7){
    format(string, sizeof(string), "Mes: Julho");
    TextDrawSetString(LMonth, string);
    }
    else if(Month == 8){
    format(string, sizeof(string), "Mes: Agosto");
    TextDrawSetString(LMonth, string);
    }
    else if(Month == 9){
    format(string, sizeof(string), "Mes: Setembro");
    TextDrawSetString(LMonth, string);
    }
    else if(Month == 10){
    format(string, sizeof(string), "Mes: Outubro");
    TextDrawSetString(LMonth, string);
    }
    else if(Month == 11){
    format(string, sizeof(string), "Mes: Novembro");
    TextDrawSetString(LMonth, string);
    }
    else if(Month == 12){
    format(string, sizeof(string), "Mes: Dezembro");
    TextDrawSetString(LMonth, string);
    }
    switch(Hour){
    case 0..5:{
    format(string, sizeof(string), "~y~Bom dia!!");
    TextDrawSetString(LMsg, string);
    }
    case 6..11:{
    format(string, sizeof(string), "~y~Bom dia!");
    TextDrawSetString(LMsg, string);
    }
    case 12..17:{
    format(string, sizeof(string), "~g~Boa tarde!");
    TextDrawSetString(LMsg, string);
    }
    case 18..23:{
    format(string, sizeof(string), "~b~Boa noite!");
    TextDrawSetString(LMsg, string);
    }
    }
    return 1;
}

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// -> Update Clock Hours <-
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
public L_UpdateClock()
{
    new Year,Month;
    new Day,Hour;
    new Min,Second;
    new nstring[5];
    getdate(Year, Month, Day);
    gettime(Hour, Min, Second);
    TextDrawShowForAll(LHour);
    TextDrawShowForAll(LDay);
    TextDrawShowForAll(LMonth);
    TextDrawShowForAll(LInfo);
    TextDrawShowForAll(LCategory);
    TextDrawShowForAll(LMsg);
    TextDrawShowForAll(LText1);
    TextDrawShowForAll(LText2);
    TextDrawShowForAll(LText3);
    TextDrawShowForAll(LText4);
    TextDrawShowForAll(LText5);
    TextDrawShowForAll(LText6);
    TextDrawShowForAll(LText7);
    TextDrawShowForAll(LuxClock_Center);
   
    for(new l; l < 12; l++) TextDrawShowForAll(LuxClock[l]);
    if (Hour > 12) Hour -= 12;
    if (Hour == 0) Hour = 12;
    for(new l; l < 12; l++){
    if (Hour-1 == l){
    format(nstring, sizeof nstring, "~w~%s", Tstring[DelTime]);
    TextDrawSetString(LuxClock[DelTime], nstring);
    TextDrawShowForAll(LuxClock[DelTime]);
    //SetWorldTime(Hour);
    format(nstring, sizeof nstring, "~r~%d", l+1);
    TextDrawSetString(LuxClock[l], nstring);
    TextDrawShowForAll(LuxClock[l]); DelTime = l;
    break;
    }
    }
    }
Reply
#2

Mas deonde vocк vai tirar a hora REAL se nгo for do PC?
Reply
#3

Ok, entгo so posso por a hora certa se pedir pro suporte do host mudar a hora do PC que ta hospedando?
Reply
#4

Quote:
Originally Posted by ceesar90
Посмотреть сообщение
Ok, entгo so posso por a hora certa se pedir pro suporte do host mudar a hora do PC que ta hospedando?
Sim...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)