royalpala
Well-Known Member
- Joined
- Dec 31, 2019
- Messages
- 85
- Solutions
- 1
- Reaction score
- 68
i made this to work with a storage onDeEquip function but it wont stop looping
does anyone knows where the problem is???
I used the script from @Darkhaos here ----->>> Raibow Outfit (https://otland.net/threads/raibow-outfit.35629/)
TFS 0.4
thanks in advance
does anyone knows where the problem is???
I used the script from @Darkhaos here ----->>> Raibow Outfit (https://otland.net/threads/raibow-outfit.35629/)
TFS 0.4
Lua:
local colors = {94, 81, 79, 88, 18, 11, 92, 128}
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 outfit = getCreatureOutfit(cid)
local tmp = {}
if isPlayer(cid) then
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)
setPlayerStorageValue(cid,14000,-1)
local event = addEvent(repeatChangeOutfit, 200, cid)
return TRUE
elseif getPlayerStorageValue (cid, 14000) == 1 then
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 outfit = getCreatureOutfit(cid)
local tmp = {}
if isPlayer(cid) then
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)
setPlayerStorageValue(cid,14000,-1)
local event = addEvent(changeOutfit, 200, cid)
return TRUE
elseif getPlayerStorageValue (cid, 14000) == 1 then
stopEvent(event)
return TRUE
end
end
function onEquip(cid, item, slot)
addEvent(changeOutfit, 200, cid)
return TRUE
end
function onDeEquip(cid, item, slot)
if getPlayerStorageValue(cid, 14000) == -1 then
setPlayerStorageValue(cid,14000,1)
end
end
thanks in advance
Last edited: