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

Talkaction/globalevent script - one word contest

Fiodor

Lua & Maps
Joined
Mar 14, 2009
Messages
400
Reaction score
10
Location
Poland
Hello

I'm looking for someone who would make this script:
1-2 times per hour appears text "Who first say word 'xxx' wins a prize!', and player, who as first writes in default this word, wins some item

I hope you understood me ;P
 
Hello

I'm looking for someone who would make this script:
1-2 times per hour appears text "Who first say word 'xxx' wins a prize!', and player, who as first writes in default this word, wins some item

I hope you understood me ;P

LUA:
local words = {
	"hurray",
	"mission",
	"pokemon",
	"noob"
}
local items = {
	8871,
	2342
}
function onStartup()
	setGlobalStorageValue(5000, 1)
	return true
end
function onThink(interval, lastExecution)
	word = words[math.random(1, #words)]
	setGlobalStorageValue(5000, -1)
	setGlobalStorageValue(5001, word)
	doBroadcastMessage("First person who say \" !contest " .. word .." \" will win a random item!")
	return true
end
function onSay(cid, words, param)
	if(param == nil) then
		return true
	end
	if(getGlobalStorageValue(5000) == -1) then
		if(param == getGlobalStorageValue(5001)) then
			reward = items[math.random(1, #items)]
			doPlayerAddItem(cid, reward, 1)
			setGlobalStorageValue(5000, 1)
			doBroadcastMessage(getPlayerName(cid) .. " has won the \"one word\" contest and won " .. getItemNameById(reward) .. "!")
		end
	end
	return true
end
XML:
<globalevent name="contest" interval="1800000" event="script" value="contest.lua"/>
<globalevent name="constestStart" type="start" event="script" value="contest.lua"/>
<talkaction words="!contest" event="script" value="contest.lua"/>
 
22:55 First person who say " !contest mission " will win a random item!
22:55 GOD Fiodor has won the "one word" contest and won helmet of the ancients!

22:56 You see a helmet of the ancients (Arm:8).
It weighs 27.60 oz.
The gem of the helmet is burned out and should be replaced.
ItemID: [2342].
Position: [X: 998] [Y: 1003] [Z: 7].

It works perfectly, thank you teckman :D rep+
 
Back
Top