• 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!

Raids

Erazma

Banned User
Joined
Sep 3, 2012
Messages
265
Reaction score
4
Siemka ponownie :P
kożystam z http://otland.net/f118/gesior-aac-latest-raids-169433/ i ustawiłem globalevents <globalevent name="raid" interval="60" event="script" value="raids.lua"/> więc co 1 minetke pojawia sie najazd bosa
1.jpg

1.jpg

Chciałbym aby ten rajd był wywoływany losowo co jakiś czas nie co minute jak to zrobić ?
 
LUA:
if (math.random(0, 100) > 10) then
	return
end
Co minutę losuje liczbę z przedziału od 1-100 i jeśli ta liczba będzie mniejsza niż dziesięć, wtedy event się odbędzie.
 
Code:
local dbHandle = db.query and db.query or db.executeQuery;
local raids = {"Massacre","Dracola","The Handmaiden","The Imperor","Mr. Punish","Countess Sorrow","The Plasmother","Ferumbras","Morgaroth","x1","x2","x3"}
local raidsToday = 0;
function onThink(interval, lastExecution)
if (tonumber(os.date("%d")) ~= getStorage(44444)) then
doSetStorage(44444, (tonumber(os.date("%d"))))
raidsToday = 0;
end
if (raidsToday < 10000) [B][COLOR="#FF0000"]and (math.random(0, 100) > 10)[/COLOR][/B] then
local raidID = math.random(#raids);
dbHandle("INSERT INTO `raids`(`raid`, `time`) VALUES (".. raidID ..", "..os.time()..");");
executeRaid(raids[raidID]);
raidsToday = raidsToday + 1;
end
return TRUE
end
dobrym miejscu dodalem?
 
A daj gotowy skrypt rajdu. Ten przed twoją edycją.
 
To co ci wyżej podesłałem po prostu daj bezpośrednio po tej linijce:
LUA:
function onThink(interval, lastExecution)
 
Code:
local dbHandle = db.query and db.query or db.executeQuery;
local raids = {"Massacre","Dracola","The Handmaiden","The Imperor","Mr. Punish","Countess Sorrow","The Plasmother","Ferumbras","Morgaroth","x1","x2","x3"}
local raidsToday = 0;
function onThink(interval, lastExecution)
if (math.random(0, 100) > 10) then
	return
end
if (tonumber(os.date("%d")) ~= getStorage(44444)) then
doSetStorage(44444, (tonumber(os.date("%d"))))
raidsToday = 0;
end
if (raidsToday < 10000) then
local raidID = math.random(#raids);
dbHandle("INSERT INTO `raids`(`raid`, `time`) VALUES (".. raidID ..", "..os.time()..");");
executeRaid(raids[raidID]);
raidsToday = raidsToday + 1;
end
return TRUE
end
A teraz to return i end nie jest w złym miejscu?
 
bez%C2%A0tytu%C5%82u.jpg

ustawilem globalevents.xml zeby wczytywal co 1 sekunde do testu
i skrypt dziala ... tylko ten jeden blad zostal

Code:
local dbHandle = db.query and db.query or db.executeQuery;
local raids = {"Massacre","Dracola","The Handmaiden","The Imperor","Mr. Punish","Countess Sorrow","The Plasmother","Ferumbras","Morgaroth","x1","x2","x3"}
local raidsToday = 0;
function onThink(interval, lastExecution)

if (tonumber(os.date("%d")) ~= getStorage(44444)) then
doSetStorage(44444, (tonumber(os.date("%d"))))
raidsToday = 0;
end
if (math.random(0, 100) > 90) then
if (raidsToday < 10000) then
local raidID = math.random(#raids);
dbHandle("INSERT INTO `raids`(`raid`, `time`) VALUES (".. raidID ..", "..os.time()..");");
executeRaid(raids[raidID]);
raidsToday = raidsToday + 1;
end
return
end
return TRUE
end
 
Last edited:
Zobacz to.
Code:
local raids = {"Massacre", "Dracola", "The Handmaiden", "The Imperor", "Mr. Punish", "Countess Sorrow", "The Plasmother", "Ferumbras", "Morgaroth", "x1", "x2", "x3"}
local raidsToday = 0


function onThink(interval)
	if(tonumber(os.date("%d")) ~= getStorage(44444)) then
		doSetStorage(44444, (tonumber(os.date("%d"))))
		raidsToday = 0
	end
	
	if(math.random(0, 100) > 10) then
		return true
	end
	
	if(raidsToday > 10000) then
		return true
	end
	
	local raidID = math.random(1, #raids)
	db.executeQuery("INSERT INTO `raids`(`raid`, `time`) VALUES (" .. raidID .. ", " .. os.time() .. ");")
	executeRaid(raids[raidID])
	raidsToday = raidsToday + 1
	return true
end
 
Nie idzie poprzedni blad + w 11 lini

- - - Updated - - -

Code:
local dbHandle = db.query and db.query or db.executeQuery;
local raids = {"Massacre","Dracola","The Handmaiden","The Imperor","Mr. Punish","Countess Sorrow","The Plasmother","Ferumbras","Morgaroth","x1","x2","x3"}
local raidsToday = 0;
function onThink(interval, lastExecution)

if (tonumber(os.date("%d")) ~= getStorage(44444)) then
doSetStorage(44444, (tonumber(os.date("%d"))))
raidsToday = 0;
end
if (raidsToday < 10000) and math.random(0, 100) > 99 then
local raidID = math.random(#raids);
dbHandle("INSERT INTO `raids`(`raid`, `time`) VALUES (".. raidID ..", "..os.time()..");");
executeRaid(raids[raidID]);
raidsToday = raidsToday + 1;
end
return TRUE
end
'działczy
 
Siemka ponownie :P
więc co 1 minetke pojawia sie najazd bosa
1.jpg

a ilu jedna jednostka "minetki" równa się minutom ? czy to zależne od umiejętności i wielkości mięśni języka?


#temat

w sumie fajny skrypt na stronkę, myślałem kiedyś o czymś takim, ale fajniej by było poprostu zmienić to w funkcji raidów


function onRaid

czy jakaś inna czy to była executeRaid czy coś i przy niej dać wysyłanie do bazy danych danych o raidzie
 
Zamiast tego
LUA:
if (math.random(0, 100) > 10) then
	return
end
Daj takie coś (to powinno usunąć ten błąd z konsoli)
LUA:
if (math.random(0, 100) > 10) then
	return true
end
 
Back
Top