Witamy Na OTS Fans, Przeczytaj Regulamin lub Zarejestruj się.
I User
Autorem Jest TPlayer
Oryginalny Temat
1. Najpierw kod na czas realistyczny:
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" />
2. Teraz skrypt na czas Tibijski:
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" />
Offline