• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Globalevent zmieniający wartość expRate.

Verdis

Ciekawy świata.
Joined
May 28, 2012
Messages
394
Reaction score
9
Location
Poland
Siemka,
Jak zrobić scrypt, który np o 12:00 aktywuje exp*2?
Jedyne co się orientuję to:
PHP:
function onTime(time)
end
ale jak ktoś by dobrze wytłumaczył to się jakoś ogarnie :)
Proszę o pomoc...
 
może dla wszystkich onlajnów zrób to funkcją
doPlayerSetRate(cid, type, value)

a potem w login lua też jakoś ?? niewiem
 
Ale jak dodać ile razy większy ? doPlayerSetRate(cid, type, value) :)
 
Np.
Code:
doPlayerSetRate(cid, SKILL__LEVEL, 2.0)
2.0 oznacza, że exp danego gracza zostanie zwiększony o 100%

@down
Tak, 8 czyli "SKILL__LEVEL"
 
Last edited:
PHP:
function onTime()
doPlayerSetRate(cid, type, value)
doPlayerSetRate(cid, SKILL__LEVEL, 2.0)
doBroadcastMessage("Exp zwiekszony 2x!")
return true
end

Player not Found ;/ cięgle
 
Więc posłuchaj odpowiedzi użytkownika The_Hide.
 
PHP:
function onTime()
local bonus_rate = 1.2 -- 20% wiecej expa
local czas_bonusu = 2 * 60 * 60 * 1000      -- 2 godziny


setGlobalStorageValue(cid, 12723, 1)
for i, tid in ipairs(getPlayersOnline()) do
doPlayerSetExperienceRate(cid, (getPlayerExpRate(cid) * bonus_rate))
end

local function koniec_bonusu()
setGlobalStorageValue(cid, 12723, 0)
	for i, tid in ipairs(getPlayersOnline()) do
	doPlayerSetExperienceRate(cid, (getPlayerExpRate(cid) / bonus_rate))
	end
end

addEvent(koniec_bonusu, czas_bonusu)
return TRUE
end


pisane na kolanie, nie sprawdzane


miałem pisać jeszcze funkcję w login.lua, która dodaje bonus exp rate gdy getGlobalStorageValue(cid, 12723) == 1 i odejmuje(jeżeli bonus exp rate nie usuwa się po logout) gdy getGlobalStorageValue(cid, 12723) == 0, ale nie zdążyłem i muszę spadać, może komuś będzie się chciało ją dopisać



EDIT:
jeszcze zauważyłem, że gracz który nie będzie online przy wywołaniu eventu, natomiast będzie online gdy się skończy skrypt nada mu exp stage mniejszy do normalnego, pokombinowałbym coś z "setPlayerExtraExpRate(cid)" ale muszę spadać, może jutro dokończę wszystko
 
Niestety nie działa ;/
PHP:
<globalevent name="expierimence" time="12:44:00" event="script" value="exp.lua"/>
[PHP]function onTime()
local bonus_rate = 1.2 -- 20% wiecej expa
local czas_bonusu = 2 * 60 * 60 * 1000      -- 2 godziny


setGlobalStorageValue(cid, 12723, 1)
for i, tid in ipairs(getPlayersOnline()) do
doPlayerSetExperienceRate(cid, (getPlayerExpRate(cid) * bonus_rate))
end

local function koniec_bonusu()
setGlobalStorageValue(cid, 12723, 0)
    for i, tid in ipairs(getPlayersOnline()) do
    doPlayerSetExperienceRate(cid, (getPlayerExpRate(cid) / bonus_rate))
    end
end

addEvent(koniec_bonusu, czas_bonusu)
return TRUE
end


bug.jpg
 
Back
Top