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

Random otufit for 50 cc

Nightimarez

New Member
Joined
Jul 24, 2008
Messages
287
Reaction score
2
I'm trying to make a script that gives you a random creature outfit by pulling a lever for 50 crystal coins.

PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	   local c = {4, 5, 6, 7, 8, 9, 10}
        if doPlayerRemoveMoney(cid, 500000) == TRUE then
            local pPos = getPlayerPosition(cid)
            	doSendMagicEffect(pPos, 26)
			doCreatureChangeOutfit(cid, c[math.random(#c)])
						doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got a random outfit for 50 Crystal coins!")
			else
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need 50 Crystal coins.")
			end
        return TRUE
end

I'm getting this error.
PHP:
[22/02/2012 04:12:28] 	[C]: ?
[22/02/2012 04:12:28] 	[C]: in function 'doCreatureChangeOutfit'
[22/02/2012 04:12:28] 	data/actions/scripts/addons/random outfit.lua:6: in function <data/actions/scripts/addons/random outfit.lua:1>
 
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition) 
       local c = {4, 5, 6, 7, 8, 9, 10} 
        if doPlayerRemoveMoney(cid, 500000) == TRUE then 
            local pPos = getPlayerPosition(cid) 
                doSendMagicEffect(pPos, 26) 
            doSetCreatureOutfit(cid, {lookType = c[math.random(#c)]}, -1) 
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got a random outfit for 50 Crystal coins!") 
            else 
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need 50 Crystal coins.") 
            end  
        return TRUE 
end
 
Thank you guys :] If they relog, the outfit goes away. Any way to keep it perm? I used doCreatureChangeOutfit cause of the /newtype command.
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
	local cost = 50 -- cc
 
        -- Custom outfits --
	local customOutfit = false
	local monstersLookType = {12, 4, 32, 94}
 
-- else --
        -- Random from, to looktype --
	local lookTypeMin, lookTypeMax = 2, 100 -- Don't choose 1 because it will crash your client
 
 
	--- Don't touch ---
	local CustomOutfits = {lookType = monstersLookType[math.random(#monstersLookType)], lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
	local MathRandomOutfit = {lookType = math.random(lookTypeMin, lookTypeMax), lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
 
	if(pay(cid, cost*100*100) then
		if(customOutfit == true) then
			doCreatureChangeOutfit(cid, CustomOutfits)
		else
			doCreatureChangeOutfit(cid, MathRandomOutfit)
		end
	else
		doPlayerSendCancel(cid, "Sorry, not enough gold coin. [50cc]")
	end
 
	doSendMagicEffect(getCreaturePosition(cid), 12)
	return true
end
 
Thank you guys :] If they relog, the outfit goes away. Any way to keep it perm? I used doCreatureChangeOutfit cause of the /newtype command.

use storage with outfits.xml

Code:
<outfit id="32" quest="STORAGE">
<list gender="0-3" lookType="4" name="orc"/>
</outfit>

example:

Code:
<outfit id="32" quest="11322">
<list gender="0-3" lookType="264" name="Brutetamer"/>
</outfit>
 
@WarOfTheTitans

[22/02/2012 23:12:36] Warning: [Event::checkScript] Can not load script. /scripts/addons/random outfit.lua
[22/02/2012 23:12:37] data/actions/scripts/addons/random outfit.lua:18: ')' expected near 'then'
 
Try this, and tell me if there are any errors.
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition) 
       local c = {4, 5, 6, 7, 8, 9, 10} 
        if doPlayerRemoveMoney(cid, 500000) == TRUE then 
            local pPos = getPlayerPosition(cid) 
                doSendMagicEffect(pPos, 26) 
            doCreatureChangeOutfit(cid, {lookType = c[math.random(#c)]}) 
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got a random outfit for 50 Crystal coins!") 
            else 
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need 50 Crystal coins.") 
            end  
        return TRUE 
end
 
Back
Top