OTS Fans

Witamy Na OTS Fans, Przeczytaj Regulamin lub Zarejestruj się.

  • Nie jesteś zalogowany.
  • Polecamy: Moda

#1 2011-04-17 06:49:01

Xelemeleque

I User

Zarejestrowany: 2011-04-14
Posty: 17
Punktów :   

Zegarki pokazujące czas realny i tibijski

Autorem Jest TPlayer
Oryginalny Temat


1. Najpierw kod na czas realistyczny:


Tworzymy plik clock.lua w data/actions/scripts i wklejamy to:

Kod:

function onUse(cid, item, frompos, item2, topos)

data = os.date('%c')

doPlayerSendTextMessage(cid, 22, ""..data.."")
end

return 1

Na koniec otwieramy plik actions.xml w data/actions i dopisujemy to:

Kod:

<action itemid="2036" script="clock.lua" />
<action itemid="1728" script="clock.lua" />
<action itemid="1729" script="clock.lua" />
<action itemid="1730" script="clock.lua" />
<action itemid="1731" script="clock.lua" />


2. Teraz skrypt na czas Tibijski:



Tworzymy plik watch.lua w data/actions/scripts i wklejamy to:

Kod:

function onUse(cid, item, frompos, item2, topos)

twentyfour = false 
tibiantime = true 

if (tibiantime == false) then
if (twentyfour == true) then
time = os.date('%H:%M')
else
time = os.date('%I:%M %p')
end
else
time = rl2tib(os.date('%M'), os.date('%S'), twentyfour)
end
doPlayerSendTextMessage(cid, 22, "The time is "..time..".")
return 1
end

function rl2tib(min, sec, twentyfour)

suffix = ''
varh = (min*60+sec)/150
tibH = math.floor(varh) 
tibM = math.floor(60*(varh-tibH)) 

if (twentyfour == false) then
if (tonumber(tibH) > 11) then
tibH = tonumber(tibH) - 12
suffix = ' pm'
else
suffix = ' am'
end
if (tibH == 0) then
tibH = 12
end
end
if (tibH < 10) then
tibH = '0'..tibH
end
if (tibM < 10) then
tibM = '0'..tibM
end
return (tibH..':'..tibM..suffix)
end

Na koniec otwieramy plik actions.xml w data/actions i dopisujemy to:

Kod:

<action itemid="2036" script="watch.lua" />
<action itemid="1728" script="watch.lua" />
<action itemid="1729" script="watch.lua" />
<action itemid="1730" script="watch.lua" />
<action itemid="1731" script="watch.lua" />

Offline

 

Stopka forum

RSS
Powered by PunBB 1.2.23
© Copyright 2002–2008 PunBB
Polityka cookies - Wersja Lo-Fi

[ Generated in 0.009 seconds, 10 queries executed ]


Darmowe Forum | Ciekawe Fora | Darmowe Fora
www.k800icentrum.pun.pl www.agh1rokis.pun.pl www.zrom.pun.pl www.narutek.pun.pl www.ricoe.pun.pl