• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

GlobalEvent Lottery System - Win Best Online Player!

Perun

nems.online
Joined
May 1, 2009
Messages
378
Solutions
7
Reaction score
176
Hi, I created a script lottery. The winner is the highest level of online players.
I do not have time to improve, put an improved version tomorrow.


Data/globalevents/scripts/arkam.lua

PHP:
-- by Arkam
--- TNP go Death!
local ustawienia = {
    czas_losowan = "3 Godziny", -- time to next loss
    nagrody = {2494, 2472, 2514, 2160, 8887, 8886, 8866,  2342, 2495, 8868, 8871}, -- reward ids
    crystal_counts = math.random(1,100),   --math crystal coin counts
    }
function onThink(interval, lastExecution)
local nuby = getPlayersOnline()
local record = {0, 0}
for i, tid in ipairs(nuby) do
local level = getPlayerLevel(tid)
if(level > record[2]) then
record[1] = tid
record[2] = level
end
end
local smiec = ustawienia.nagrody[math.random(1, #ustawienia.nagrody)]
local nazwa =  getItemNameById(smiec)
                if(smiec == 2160) then
                        doPlayerAddItem(record[1], smiec, ustawienia.crystal_counts)
                        doBroadcastMessage('[LOTTERY SYSTEM] Zwycieza: '.. getCreatureName(record[1]) ..', I otrzymuje: '.. ustawienia.crystal_counts ..' '.. nazwa ..'gratulacje! (Nastepne losowanie za '.. ustawienia.czas_losowan ..')')
                else
                        doBroadcastMessage('[LOTTERY SYSTEM] Winner: '.. getCreatureName(record[1]) ..', Reward: '.. nazwa ..'! Congratulations! (Next Lottery in '.. ustawienia.czas_losowan ..')')
                        doPlayerAddItem(record[1], smiec, 1)
                end
    return TRUE
end

Globalevents.xml


PHP:
<globalevent name="arkam" interval="360000" event="script" value="arkam.lua"/>

// Thanks to DominikMS for Help :)

@Down: asusahuashuas gz noob, you no have parents? ;/ dont cry.. maybe you can learn create script, but now you can only copy uashusauhsa
 
Last edited:
huh?
i think its Morlad script,
Its PL script... you arent pl ^.-

Wtf?
 
@UP:
ENG: I'm not pl? hahahah look on [Loteria] [Zwycieza Best LVL]-Tibia 8.60 - Tibia.net.pl Arkam Shadow noob, and look at date create thread :) Morland is noob and he can only copy scripts.. "// Thanks to DominikMS for Help" << DominikMS from otland and from tnp.. he are owner a Online Pokemon project, and he help me with this script.. ask him nooob :)

PL: Ja nie jestem polakiem? ty chyba zes sie z ch*** głowami pozamieniał niedo***** :) Więc zanim zaczniesz komentowac ogarnij kto z kad jest, nawet ci sie nie chcialo na tnp sprawdzic jaki mam nick dzieciaku.. szkoda mi takich jak wy ;/
 
0 comments? why xd!
What i can add to this script?
 
0 comments? why xd!
because this sux. English veriables is standard, in Poland too. If you go into programmist school you got know it.

PHP:
local config = {
	intime = "3 Hours", 
	rewards = {
		{2160, 10},
		{2472, 1},
		{8886, 1},
	}
}

function onThink(interval, lastExecution)

	local best = {0, 0}
	for _, pid in ipairs(getPlayersOnline()) do
		if (getPlayerExperience(pid) > best[1]) then
			best[1] = getPlayerExperience(pid)
			best[2] = pid
		end
	end
	local reward = config.rewards[math.random(1,#config.reward)]
	doPlayerAddItem(reward[1], reward[2], true)
	doBroadcastMessage('[LOTTERY SYSTEM] Winner: '.. getCreatureName(best[2]) ..', Reward: '.. ((reward[2]>1) and (reward[2]..' '..getItemNameById(reward[1])..'\'s') or getItemNameById(reward[1])) ..'! Congratulations! (Next Lottery in '.. config.intime ..')')
end


and you should add credits to vDK, because you base on his script... http://otland.net/f82/lottery-system-44496/
 
Back
Top