SA-MP Forums Archive
[FilterScript] Hora en TextDraw - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+----- Forum: Lanzamientos/Releases (https://sampforum.blast.hk/forumdisplay.php?fid=59)
+----- Thread: [FilterScript] Hora en TextDraw (/showthread.php?tid=241637)



Hora en TextDraw - Troka - 18.03.2011

Buenas aqui dejo una pequeсa funcion que separe del FS V-Admin se trata de un reloj que muestra la hora

con un textdraw y se ve bastante bien aqui una imagen:



Repito ese reloj es EXACTAMENTE IGUAL al que tiene el sistema de administracion V-Admin yo simplemente

lo separe para poderlo poner en un GM sin necesidad de tener que agregar todo el sistema de administracion..

bueno aqui esta todo lo que deben hacer:

pawn Код:
//Forwards

forward Clock(playerid);

//Variables - Arrays

new Text:Textdraw99;
new Text:Textdraw88;

//publics

public Clock(playerid)
{
    new string[256];
    new string2[256];
    new year, month, day;
    new hour, minute, second;
    getdate(year, month, day);
    gettime(hour,minute,second);
    new mtext[20];
    getdate(year, month, day);
    if(month == 1) { mtext = "January"; }
    else if(month == 2) { mtext = "February"; }
    else if(month == 3) { mtext = "March"; }
    else if(month == 4) { mtext = "April"; }
    else if(month == 5) { mtext = "May"; }
    else if(month == 6) { mtext = "June"; }
    else if(month == 7) { mtext = "July"; }
    else if(month == 8) { mtext = "August"; }
    else if(month == 9) { mtext = "September"; }
    else if(month == 10) { mtext = "October"; }
    else if(month == 11) { mtext = "November"; }
    else if(month == 12) { mtext = "December"; }
    format(string, sizeof(string), "%d %s, %d", day, mtext, year);
    TextDrawSetString(Text:Textdraw99, string);
    format(string2, sizeof(string2), "%d:%d:%d", hour, minute, second);
    TextDrawSetString(Text:Textdraw88, string2);
}

public OnGameModeInit()
{
    SetTimer("Clock", 1000, 1); // Updates the clock every 1 second
    Textdraw99 = TextDrawCreate(450.000000,5.000000, "--");
    Textdraw88 = TextDrawCreate(551.000000,23.000000,"--");
    TextDrawAlignment(Textdraw99,0);
    TextDrawAlignment(Textdraw88,0);
    TextDrawBackgroundColor(Textdraw99,0x0000ffff);
    TextDrawBackgroundColor(Textdraw88,0x0000ffff);
    TextDrawFont(Textdraw99,2);
    TextDrawLetterSize(Textdraw99,0.499999,1.500000);
    TextDrawFont(Textdraw88,2);
    TextDrawLetterSize(Textdraw88,0.399999,2.000000);
    TextDrawColor(Textdraw99,0x00ffffff);
    TextDrawColor(Textdraw88,0x00ffffff);
    TextDrawSetOutline(Textdraw99,1);
    TextDrawSetOutline(Textdraw88,1);
    TextDrawSetProportional(Textdraw99,1);
    TextDrawSetProportional(Textdraw88,1);
    TextDrawSetShadow(Textdraw99,1);
    TextDrawSetShadow(Textdraw88,1);
    return 1;
}

public OnPlayerConnect(playerid)
{
    TextDrawShowForPlayer(playerid, Textdraw99);
    TextDrawShowForPlayer(playerid, Textdraw88);
    return 0;
}
Simplemente definan las variables, el forward y en los publics que puse agreguen lo que puse

y listo saludos!!

Creditos:

V-Admin - 100%

Yo simplemente retire el reloj para poderlo usar saludos!!!


Respuesta: Hora en TextDraw - leaNN! - 18.03.2011

Muy bien Troka, solo faltaria traducir los meses.
Acordate de usar [pawn] y [./pawn], asi queda bien el codigo, con le highlight y todo.


Re: Hora en TextDraw - Troka - 18.03.2011

Perdona me olvide de eso :P si quieren traducirlos solo cambien el nombre aqui:

pawn Код:
if(month == 1) { mtext = "January"; }
    else if(month == 2) { mtext = "February"; }
    else if(month == 3) { mtext = "March"; }
    else if(month == 4) { mtext = "April"; }
    else if(month == 5) { mtext = "May"; }
    else if(month == 6) { mtext = "June"; }
    else if(month == 7) { mtext = "July"; }
    else if(month == 8) { mtext = "August"; }
    else if(month == 9) { mtext = "September"; }
    else if(month == 10) { mtext = "October"; }
    else if(month == 11) { mtext = "November"; }
    else if(month == 12) { mtext = "December"; }
y listo saludos!!


Re: Hora en TextDraw - [L3th4l] - 18.03.2011

pawn Код:
switch(month)
{
    case 1: mtext = "Enero";
    case 2: mtext = "Febrero";
    case 3: mtext = "Marzo";
    case 4: mtext = "Abril";
    case 5: mtext = "Mayo";
    case 6: mtext = "Junio";
    case 7: mtext = "Julio";
    case 8: mtext = "Agosto";
    case 9: mtext = "Septiembre";
    case 10: mtext = "October"
    case 11: mtext = "Noviembre";
    case 12: mtext = "Diciembre";
}
Codigo mas eficiente, y traducido


Respuesta: Hora en TextDraw - leaNN! - 18.03.2011

Lethal, solo un pequeсo "off topic": October es Octubre en espaсol.


Re: Hora en TextDraw - Troka - 18.03.2011

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
pawn Код:
switch(month)
{
    case 1: mtext = "Enero";
    case 2: mtext = "Febrero";
    case 3: mtext = "Marzo";
    case 4: mtext = "Abril";
    case 5: mtext = "Mayo";
    case 6: mtext = "Junio";
    case 7: mtext = "Julio";
    case 8: mtext = "Agosto";
    case 9: mtext = "Septiembre";
    case 10: mtext = "October"
    case 11: mtext = "Noviembre";
    case 12: mtext = "Diciembre";
}
Codigo mas eficiente, y traducido
Muchisimas gracias =) tambien lo usare para ver :P claro si no te molesta

saludos!!


Respuesta: Hora en TextDraw - Jovanny - 19.03.2011

borra el parametro playerid de
pawn Код:
forward Clock(playerid);
quedando asi
pawn Код:
forward Clock();
tambien borralo del callback
quedando asi
pawn Код:
public Clock()
{


}



Re: Hora en TextDraw - jeanpierrevera - 30.03.2011

como descactivar la hora normal ya q sale en la pantalla como la descactivo en el server


Respuesta: Hora en TextDraw - SuperMarioRol - 31.03.2011

En OnPlayerConnect
pawn Код:
TogglePlayerClock(playerid,0);



Re: Hora en TextDraw - jeanpierrevera - 01.04.2011

no funciono lo puse y sigue saliendo

pawn Код:
public OnPlayerConnect(playerid)
{
TogglePlayerClock(playerid,0);
return 1;
}