Szerző Téma: Reális idõ textdraw  (Megtekintve 1691 alkalommal)

Reális idõ textdraw
« Dátum: 2014. Június 23. - 09:46:14 »
0 Show voters
Sziasztok!
Ez egy óra filterszkript ami a képernyõ jobb felsõ sarkába kiírja a jelenlegi idõt és a dátumot
A dátum angol sorrendben van  :angel:
Tehát így: /nap/hónap/év
----------------------------------------------------------------------------------------------------------------------
Készítõ: Shadow
Eredeti link: http://forum.sa-mp.com/showthread.php?t=70445
Kép:
\"29av09l.jpg\"
Letöltés: http://www.solidfiles.com/d/21038eb598/world.pwn
Kód:
 
#include <a_samp>
    #define FILTERSCRIPT
    new Text:Time, Text:Date;
    forward settime(playerid);
    public OnFilterScriptInit()
    {
            print(\"\\n--------------------------------------\");
            print(\" Updated Version! WORLDCLOCK+DATE By Shadow\");
            print(\"--------------------------------------\\n\");
            SetTimer(\"settime\",1000,true);
            Date = TextDrawCreate(547.000000,11.000000,\"--\");
            TextDrawFont(Date,3);
            TextDrawLetterSize(Date,0.399999,1.600000);
            TextDrawColor(Date,0xffffffff);
            Time = TextDrawCreate(547.000000,28.000000,\"--\");
            TextDrawFont(Time,3);
            TextDrawLetterSize(Time,0.399999,1.600000);
            TextDrawColor(Time,0xffffffff);
 
            SetTimer(\"settime\",1000,true);
            return 1;
    }
    public OnFilterScriptExit()
    {
            print(\"\\n-----------------------------------------------------\");
            print(\" Updated Version! WORLDCLOCK+DATE By Shadow !UNLOADED!\");
            print(\"-----------------------------------------------------/n\");
            return 1;
    }
    public OnPlayerSpawn(playerid)
    {
            TextDrawShowForPlayer(playerid, Time), TextDrawShowForPlayer(playerid, Date);
            return 1;
    }
    public OnPlayerDisconnect(playerid, reason)
    {
            TextDrawHideForPlayer(playerid, Time), TextDrawHideForPlayer(playerid, Date);
            return 1;
    }
    public settime(playerid)
    {
            new string[256],year,month,day,hours,minutes,seconds;
            getdate(year, month, day), gettime(hours, minutes, seconds);
            format(string, sizeof string, \"%d/%s%d/%s%d\", day, ((month < 10) ? (\"0\") : (\"\")), month, (year < 10) ? (\"0\") : (\"\"), year);
            TextDrawSetString(Date, string);
            format(string, sizeof string, \"%s%d:%s%d:%s%d\", (hours < 10) ? (\"0\") : (\"\"), hours, (minutes < 10) ? (\"0\") : (\"\"), minutes, (seconds < 10) ? (\"0\") : (\"\"), seconds);
            TextDrawSetString(Time, string);
    }
« Utoljára szerkesztve: 2014. Június 23. - 09:51:07 írta DragonSoul »

Nem elérhető Pedró

  • 3341
  • 2014 © Az év Szkriptere
    • Profil megtekintése
Reális idõ textdraw
« Válasz #1 Dátum: 2014. Június 23. - 12:36:38 »
0 Show voters
format(string, sizeof string, \"%s%d:%s%d:%s%d\", (hours < 10) ? (\"0\") : (\"\"), hours, (minutes < 10) ? (\"0\") : (\"\"), minutes, (seconds < 10) ? (\"0\") : (\"\"), seconds);

 
így egyszerûbb:
 
format(string, sizeof string, \"%02d:%02d:%02d\", hours, minutes, seconds);

 
eredmény ugyanaz.

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal