• 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 Rainbow outfit

PhoOwned

^_^
Joined
Nov 11, 2010
Messages
375
Reaction score
66
Rainbow outfit. Like when you use bot ;)
Players use:
!rain
GM/CM/GOD can use:
!rain 1234
to set outfit color change time to 1234 seconds.
Lua:
local default_time = 30 -- time in seconds
local fr = 5 -- frequency, changes per second
local access_to_change_time = 3 -- access needed to set own time
-- end of config

local frequency = 1000 / fr
local rainbowEvents = {}
 
function rainbowOutfit(cid, count)
	if(isPlayer(cid)) then
		local newOutfit = getCreatureOutfit(cid)
		newOutfit.lookHead = math.random(133)
		newOutfit.lookBody = math.random(133)
		newOutfit.lookLegs = math.random(133)
		newOutfit.lookFeet = math.random(133)
		doSetCreatureOutfit(cid, newOutfit, frequency + 5)
		if(count >= 1) then
			rainbowEvents[getPlayerGUID(cid)] = addEvent(rainbowOutfit, frequency, cid, count - 1)
		end
	end
end
 
function onSay(cid, words, param)
	if(rainbowEvents[getPlayerGUID(cid)] ~= nil) then
		stopEvent(rainbowEvents[getPlayerGUID(cid)])
	end
	if(param ~= '' and getPlayerAccess(cid) >= access_to_change_time) then
		rainbowOutfit(cid, tonumber(param) * fr)
	else
		rainbowOutfit(cid, default_time * fr)
	end
	return true
end
 
Last edited:
I have this error when i'm using !rain... and then logout

Lua:
[26/04/2011 23:36:50] [Error - TalkAction Interface] 
[26/04/2011 23:36:50] In a timer event called from: 
[26/04/2011 23:36:50] data/talkactions/scripts/rainbow.lua:onSay
[26/04/2011 23:36:50] Description: 
[26/04/2011 23:36:50] (luaGetCreatureOutfit) Creature not found

[26/04/2011 23:36:50] [Error - TalkAction Interface] 
[26/04/2011 23:36:50] In a timer event called from: 
[26/04/2011 23:36:50] data/talkactions/scripts/rainbow.lua:onSay
[26/04/2011 23:36:50] Description: 
[26/04/2011 23:36:50] data/talkactions/scripts/rainbow.lua:10: attempt to index local 'newOutfit' (a boolean value)
[26/04/2011 23:36:50] stack traceback:
[26/04/2011 23:36:50] 	data/talkactions/scripts/rainbow.lua:10: in function <data/talkactions/scripts/rainbow.lua:8>
 
I have this error when i'm using !rain... and then logout

Lua:
[26/04/2011 23:36:50] [Error - TalkAction Interface] 
[26/04/2011 23:36:50] In a timer event called from: 
[26/04/2011 23:36:50] data/talkactions/scripts/rainbow.lua:onSay
[26/04/2011 23:36:50] Description: 
[26/04/2011 23:36:50] (luaGetCreatureOutfit) Creature not found

[26/04/2011 23:36:50] [Error - TalkAction Interface] 
[26/04/2011 23:36:50] In a timer event called from: 
[26/04/2011 23:36:50] data/talkactions/scripts/rainbow.lua:onSay
[26/04/2011 23:36:50] Description: 
[26/04/2011 23:36:50] data/talkactions/scripts/rainbow.lua:10: attempt to index local 'newOutfit' (a boolean value)
[26/04/2011 23:36:50] stack traceback:
[26/04/2011 23:36:50] 	data/talkactions/scripts/rainbow.lua:10: in function <data/talkactions/scripts/rainbow.lua:8>

change

local newOutfit = getCreatureOutfit(cid)
 
--config ## Script By Morlad from otland.net , update by P~ ##
local default_time = 30 -- time in seconds
local fr = 5 -- frequency, changes per second
local access_to_change_time = 3 -- access needed to set own time

local frequency = 1000 / fr
local rainbowEvents = {}

function rainbowOutfit(cid, count)
local newOutfit = getCreatureOutfit(cid)
newOutfit.lookHead = math.random(133)
newOutfit.lookBody = math.random(133)
newOutfit.lookLegs = math.random(133)
newOutfit.lookFeet = math.random(133)
doSetCreatureOutfit(cid, newOutfit, frequency + 5)
if(count >= 1) then
rainbowEvents[getPlayerGUID(cid)] = addEvent(rainbowOutfit, frequency, cid, count - 1)
end
end

function onSay(cid, words, param)
if(rainbowEvents[getPlayerGUID(cid)] ~= nil) then
stopEvent(rainbowEvents[getPlayerGUID(cid)])
end
if(param ~= '' and getPlayerAccess(cid) >= access_to_change_time) then
rainbowOutfit(cid, tonumber(param) * fr)
else
rainbowOutfit(cid, default_time * fr)
end
return true
end
 
Back
Top