Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Fecha/Hora

Iniciado por Swarlog, Ene 30, 2023, 04:35 PM

Tema anterior - Siguiente tema

Swarlog

Información Adicional:

Pues se trata de script con el que podreis añadirle la fecha y hora en vuestro servidor.

Código:

#include <a_samp>

new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;

forward Actualizar();

public OnFilterScriptInit()
{

//----------------------------------------------------------
Textdraw0 = TextDrawCreate(564.000000, 7.000000, "00 De Enero Del 0000");
TextDrawAlignment(Textdraw0, 2);
TextDrawBackgroundColor(Textdraw0, -201);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.319999, 1.200000);
TextDrawColor(Textdraw0, 255);
TextDrawSetOutline(Textdraw0, 1);
TextDrawSetProportional(Textdraw0, 1);
//----------------------------------------------------------
Textdraw1 = TextDrawCreate(570.000000, 26.000000, "00:00");
TextDrawAlignment(Textdraw1, 2);
TextDrawBackgroundColor(Textdraw1, -201);
TextDrawFont(Textdraw1, 1);
TextDrawLetterSize(Textdraw1, 0.479999, 1.600000);
TextDrawColor(Textdraw1, 255);
TextDrawSetOutline(Textdraw1, 1);
TextDrawSetProportional(Textdraw1, 1);
//----------------------------------------------------------
Textdraw2 = TextDrawCreate(610.000000, 26.000000, "AM");
TextDrawAlignment(Textdraw2, 2);
TextDrawBackgroundColor(Textdraw2, -201);
TextDrawFont(Textdraw2, 1);
TextDrawLetterSize(Textdraw2, 0.490000, 1.700000);
TextDrawColor(Textdraw2, 255);
TextDrawSetOutline(Textdraw2, 1);
TextDrawSetProportional(Textdraw2, 1);
//----------------------------------------------------------
Actualizar();
SetTimer("Actualizar",1000 * 60,1);
return 1;
}

public OnFilterScriptExit()
{
TextDrawHideForAll(Textdraw0);
TextDrawDestroy(Textdraw0);
TextDrawHideForAll(Textdraw1);
TextDrawDestroy(Textdraw1);
TextDrawHideForAll(Textdraw2);
TextDrawDestroy(Textdraw2);
printf("FilterScript de la Fecha y la Hora apagado");
return 1;
}

public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid, Textdraw0);
TextDrawShowForPlayer(playerid, Textdraw1);
TextDrawShowForPlayer(playerid, Textdraw2);
return 1;
}

public Actualizar()
{
new dia,mes, mes1[128], year;
getdate(year,mes,dia);
switch(mes)
    {
case 1 : mes1 = "Enero";
case 2 : mes1 = "Febrero";
case 3 : mes1 = "Marzo";
case 4 : mes1 = "Abril";
case 5 : mes1 = "Mayo";
case 6 : mes1 = "Junio";
case 7 : mes1 = "Julio";
case 8 : mes1 = "Agosto";
case 9 : mes1 = "Septiembre";
case 10 : mes1 = "Octubre";
case 11 : mes1 = "Noviembre";
case 12 : mes1 = "Diciembre";
    }
    new fecha[128];
format(fecha,sizeof(fecha),"%d De %s Del %d",dia,mes1,year);
TextDrawSetString(Textdraw0,fecha);
//----------------------------------------------------------
new hora , hora1[128], hora2[128], minutos, tiempo[128];
gettime(hora,minutos);
switch(hora)
{
    case 0 :
    {
hora1 = "12";
tiempo = "AM";
}
    case 1 :
{
hora1 = "01";
tiempo = "AM";
}
    case 2 :
{
hora1 = "02";
tiempo = "AM";
}
    case 3 :
{
hora1 = "03";
tiempo = "AM";
}
    case 4 :
{
hora1 = "04";
tiempo = "AM";
}
    case 5 :
{
hora1 = "05";
tiempo = "AM";
}
    case 6 :
{
hora1 = "06";
tiempo = "AM";
}
    case 7 :
{
hora1 = "07";
tiempo = "AM";
}
    case 8 :
{
hora1 = "08";
tiempo = "AM";
}
    case 9 :
{
hora1 = "09";
tiempo = "AM";
}
    case 10 :
{
hora1 = "10";
tiempo = "AM";
}
    case 11 :
{
hora1 = "11";
tiempo = "AM";
}
    case 12 :
{
hora1 = "12";
tiempo = "PM";
}
    case 13 :
{
hora1 = "01";
tiempo = "PM";
}
    case 14 :
{
hora1 = "02";
tiempo = "PM";
}
    case 15 :
{
hora1 = "03";
tiempo = "PM";
}
    case 16 :
{
hora1 = "04";
tiempo = "PM";
}
    case 17 :
{
hora1 = "05";
tiempo = "PM";
}
    case 18 :
{
hora1 = "06";
tiempo = "PM";
}
    case 19 :
{
hora1 = "07";
tiempo = "PM";
}
    case 20 :
{
hora1 = "08";
tiempo = "PM";
}
    case 21 :
{
hora1 = "09";
tiempo = "PM";
}
    case 22 :
{
hora1 = "10";
tiempo = "PM";
}
    case 23 :
{
hora1 = "11";
tiempo = "PM";
}
}
format(hora2,sizeof(hora2),"%s:%d",hora1,minutos);
TextDrawSetString(Textdraw1,hora2);
TextDrawSetString(Textdraw2,tiempo);
return 1;
}