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

Rainbow Outfit

Joined
Apr 17, 2008
Messages
1,922
Solutions
1
Reaction score
188
Location
Venezuela
Hello, this script is a request from Renusek, you can see here -> http://otland.net/f132/raibow-outfit-35629/

Rainbow Outfit Script:
Lua:
llocal colors = {94, 81, 79, 88, 18, 11, 92, 128}
local storage = 65535
local time = 10 --in miliseconds

function onSay(cid, words, param, channel)

        if(param == "on") then
                if getPlayerStorageValue(cid, storage) < 1 then
                        if doPlayerRemoveMoney(cid, 5000) == TRUE then
                                local event = addEvent(changeOutfit, time, cid)
                                setPlayerStorageValue(cid, storage, 1)
                                return TRUE
                        else
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You do not have enough money.")
                                return TRUE
                        end
                else
                        return TRUE
                end
        elseif(param == "off") then
                if getPlayerStorageValue(cid, storage) > 0 then
                        setPlayerStorageValue(cid, storage, 0)
                        return TRUE
                else
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You do not have rainbow outfit on.")
                        return TRUE
                end
        else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Use !rainbow on-off.")
                return TRUE
        end
        return TRUE
end

function changeOutfit(cid)

local randomHead = colors[math.random(#colors)]
local randomLegs = colors[math.random(#colors)]
local randomBody = colors[math.random(#colors)]
local randomFeet = colors[math.random(#colors)]
local tmp = {}

        if getPlayerStorageValue(cid, storage) > 0 then
		local outfit = getCreatureOutfit(cid)
                tmp = outfit
                tmp.lookType = outfit.lookType
                tmp.lookHead = randomHead
                tmp.lookLegs = randomLegs
                tmp.lookBody = randomBody
                tmp.lookFeet = randomFeet
                tmp.lookAddons = outfit.lookAddons

                doCreatureChangeOutfit(cid, tmp)
                local event = addEvent(repeatChangeOutfit, time, cid)
                return TRUE
        else
                stopEvent(event)
                return TRUE
        end
end

function repeatChangeOutfit(cid)

local randomHead = colors[math.random(#colors)]
local randomLegs = colors[math.random(#colors)]
local randomBody = colors[math.random(#colors)]
local randomFeet = colors[math.random(#colors)]
local tmp = {}

        if getPlayerStorageValue(cid, storage) > 0 then
		local outfit = getCreatureOutfit(cid)
                tmp = outfit
                tmp.lookType = outfit.lookType
                tmp.lookHead = randomHead
                tmp.lookLegs = randomLegs
                tmp.lookBody = randomBody
                tmp.lookFeet = randomFeet
                tmp.lookAddons = outfit.lookAddons

                doCreatureChangeOutfit(cid, tmp)
                local event = addEvent(changeOutfit, time, cid)
                return TRUE
        else
                stopEvent(event)
                return TRUE
        end
end

You can add-remove colors, edit the cost.
Use !rainbow on-off

Now.. go to data/creaturescripts, create a file and add this:
Lua:
local storage = 65535

function onLogout(cid)
	setPlayerStorageValue(cid, storage, 0)
	return TRUE
end

Add this to login.lua
Lua:
	registerCreatureEvent(cid, "RainbowOutfit")

Put this in creaturescripts.xml
Lua:
	<event type="logout" name="RainbowOutfit" event="script" value="SCRIPT_NAME.lua"/>
 
Last edited:
My Idea rox :D. YES! :p.
But is anyway to fix relog?
Code:
[12/06/2009 14:07:59] Pall has logged out.

[12/06/2009 14:07:59] Lua Script Error: [TalkAction Interface] 
[12/06/2009 14:07:59] in a timer event called from: 
[12/06/2009 14:07:59] data/talkactions/scripts/rainbow_outfit.lua:onSay

[12/06/2009 14:07:59] luaGetCreatureOutfit(). Creature not found

[12/06/2009 14:08:00] Lua Script Error: [TalkAction Interface] 
[12/06/2009 14:08:00] in a timer event called from: 
[12/06/2009 14:08:00] data/talkactions/scripts/rainbow_outfit.lua:onSay

[12/06/2009 14:08:00] luaGetPlayerStorageValue(). Player not found

[12/06/2009 14:08:00] Lua Script Error: [TalkAction Interface] 
[12/06/2009 14:08:00] in a timer event called from: 
[12/06/2009 14:08:00] data/talkactions/scripts/rainbow_outfit.lua:onSay

[12/06/2009 14:08:00] data/talkactions/scripts/rainbow_outfit.lua:79: attempt to compare number with boolean
[12/06/2009 14:08:00] stack traceback:
[12/06/2009 14:08:01] 	data/talkactions/scripts/rainbow_outfit.lua:79: in function <data/talkactions/scripts/rainbow_outfit.lua:69>
[12/06/2009 14:08:02] Niepaczsie has logged in.
I don't like errors ;s.
 
Back
Top