Opis forum
Są dwa rodzaje skrypt'ów. Jeden czasz Real, a drugi czas Tibiański.
Zaczynamy od czasy Real :
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 nadzieje ze komus sie przyda :P
Offline