What's new

UpTime na OTS-Skrypt

Status
Not open for further replies.

Ichtio

Senior User
Joined
Dec 30, 2009
Messages
661
Reaction score
52
Czo?em. Potrzebuje skryptu, kt?ry co jaki? czas b?dzie wysy?a? wiadomo?? tak jak broadcast tylko ?eby w tej wiadomo?ci by?o napisane: UpTime OTS i ilo?? graczy Online.


Za pomoc Reputacja !
 

Ichtio

Senior User
Joined
Dec 30, 2009
Messages
661
Reaction score
52
Odp: UpTime na OTS-Skrypt

~~ Od?wierzam ~~
 

Unass

Active User
Joined
Jul 21, 2010
Messages
123
Reaction score
22
Odp: UpTime na OTS-Skrypt

Uptime: '.$config['status']['serverStatus_uptime'].'

wklej to w layout.php w odpowiednim miejscu
 

Ichtio

Senior User
Joined
Dec 30, 2009
Messages
661
Reaction score
52
Odp: UpTime na OTS-Skrypt

Cytuje "kt?ry co jaki? czas b?dzie wysy?a? wiadomo?? tak jak broadcast tylko ?eby w tej wiadomo?ci by?o napisane: UpTime OTS i ilo?? graczy Online" chodzi mi o Silnik a nie o Acc... Czytaj ze zrozumieniem.
 

Unass

Active User
Joined
Jul 21, 2010
Messages
123
Reaction score
22
Odp: UpTime na OTS-Skrypt

@UP
Sorry bylem taki zabiegany ze spojrzalem tylko na temat :S

Przejdzmy do rzeczy
wejdz do login.lua i dodaj linijke
setGlobalStorageValue(7832, getGlobalStorageValue(7832)+1)

w creaturescripts/scripts utworz plik logout.lua i dodaj do niego
function onLogout(cid)
setGlobalStorageValue(7832, getGlobalStorageValue(7832)-1)
return true
end
w creaturescripts.xml dodaj linijke
<event type="logout" name="logout" event="script" value="logout.lua"/>


Potem przejdz do globalevents/scripts i utworz plik online.lua
function onThink(interval, lastExecution)
local online = getGlobalStorageValue(7832) + 1
local name = getConfigValue('serverName')
if online > 1 then
doBroadcastMessage("Currently " .. online .. " players are online on " .. name .. "!" , 22)
end
if online == 1 then
doBroadcastMessage("Currently " .. online .. " player is online on " .. name .. "!" , 22)
end
if online < 1 then
doBroadcastMessage("Currently no one is online on " .. name .. "!" , 22)
end
return true
end

w globalevents.xml dodaj linijke
<globalevent name="online" interval="5000" event="script" value="online.lua"/>

interval="5000" -- to jest 5 sekund, ( 1000 = 1 sekunda ) przelicz sobie
 
Last edited:

Ichtio

Senior User
Joined
Dec 30, 2009
Messages
661
Reaction score
52
Odp: UpTime na OTS-Skrypt

Te? nie o to chodzi, ale co? podobnego. Zwyk?y skrypt globalevents typu broadcast. Poka?e lepiej tak.
Code:
local messages = {
}

         local text = {
        [1] = "Graczy online: [COLOR="Red"]xxx[/COLOR]. UpTime OTS: [COLOR="Cyan"]xxx[/COLOR]. ",
        [2] = "Inne info.",
        }
function onThink(interval, lastExecution)
doBroadcastMessage("Informacja: "..text[math.random(1,2)])
        return TRUE
end
To na ten kolor ma pisa? UpTime OTS.
A to na ten kolor ma pisa? Graczy Online ile jest.
 

Unass

Active User
Joined
Jul 21, 2010
Messages
123
Reaction score
22
Odp: UpTime na OTS-Skrypt

Moj skrypt pokazuje tylko ilosc osob online, z uptimem bedzie trudniej
 

Gesior.pl

Ten G?sior
Joined
Apr 23, 2008
Messages
88
Reaction score
19
Masz problem z zmiana koloru tekstu czy pobraniem ilosci online i uptime?
Jak chodzi o pobranie to sciagnij odpowiednie linijki z skryptow TFSa
Ilosc osob online wyswietlisz 'pokazujac' (tak jak sie wyswietla zmienne w LUA):
PHP:
#getPlayersOnline()
Uptime. Tylko zmienic pisanie 'do gracza' na funkcje 'broadcast' i masz gotowe:
PHP:
        local tmp = getWorldUpTime()
        local hours = math.ceil(tmp / 3600) - 1
        local minutes = math.ceil((tmp - (3600 * hours)) / 60)
        if(minutes == 60) then
                minutes = 0
                hours = hours + 1
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Uptime: " .. hours .. " hours and " .. minutes .. " minutes.")


--------------------
A jak chodzi o kolory tekstu to na 99.9% nie jest to mozliwe, bo tekst w jednej linijce zawsze ma jeden kolor.

Notka moderatorska:
+1 pkt OT Expert
 
Last edited by a moderator:

Ichtio

Senior User
Joined
Dec 30, 2009
Messages
661
Reaction score
52
Odp: UpTime na OTS-Skrypt

Dzi?ki kole? ;) Dobry jeste? i wyt?umaczy?e?. Masz reputa.
 
Status
Not open for further replies.
Top