ziomal11 - 2006-10-29 07:43:02

A więc...

Zacznijmy od czasu realistycznego.

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



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:



<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" />




----------------------------------------------------------------------


A oto skrypt na czas Tibiański.


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



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:



<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" />




END ;)

Mam nadzieję, że komuś się przyda.

Skrypt przeznaczony jest na Tibie 7.6

Spoiler:

DzieX ziom moj ots 83.230.26.10

Milo - 2006-10-29 12:44:49

Skyrpt własnie trafil na server ;] gz

www.shadowofbleach.pun.pl www.zgs-asg.pun.pl www.slnhlo.pun.pl www.youots.pun.pl www.wampiria.pun.pl