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

LUA Script help

Wisin

New Member
Joined
Oct 18, 2012
Messages
5
Reaction score
0
Well, hello guys!,

I do got this script,

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local v, tmp = math.random(333), getCreatureOutfit(cid)
	while isInArray({tmp.lookType, 75, 135, 266, 302}, v) == TRUE or v <= 1 or (v > 160 and v < 192) or v > 333 do
		v = math.random(351)
	end
 
	tmp.lookType = v
	doCreatureChangeOutfit(cid, tmp)
	doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
	doCreatureSay(cid, 'Your outfit has been changed.', TALKTYPE_ORANGE_1, false, cid, getThingPos(cid))
	return TRUE
end

It's an actionID in a leveler, what it does, is when you right-click it, it randomly changes your outfit, but theres a serious problem, when you got any outfit, with any random addon, and you just right-click as crazy the leveler, the outfit changes so fast, and i don't know why the players loose like 200 hitpoints, and that increases their Hitpoints so bad when they heal them, so they can bug their HP more than 33k,
I have been thinking if there's possible to add like exhaustion to the leveler? like 5 seconds, or I don't know if there's something wrong with it?

Hope anyone could help me to solve this out, thank you so much!
 
/data/xml/outfits.xml maybe there are some properties for outfits
Lua:
local EXHAUST_TIME = 10 --in seconds
local EXHAUST_STRG = 12345
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if (getCreatureStorage(cid, EXHAUST_STRG) > os.time()) then
		--exhausted
		return false
	end
	local v, tmp = math.random(333), getCreatureOutfit(cid)
	while isInArray({tmp.lookType, 75, 135, 266, 302}, v) == TRUE or v <= 1 or (v > 160 and v < 192) or v > 333 do
		v = math.random(351)
	end
 
	tmp.lookType = v
	doCreatureChangeOutfit(cid, tmp)
	doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
	doCreatureSay(cid, 'Your outfit has been changed.', TALKTYPE_ORANGE_1, false, cid, getThingPos(cid))
	doCreatureSetStorage(cid, EXHAUST_STRG, os.time()+EXHAUST_TIME)
	return true
end
with exhaustion
 
/data/xml/outfits.xml maybe there are some properties for outfits
Lua:
local EXHAUST_TIME = 10 --in seconds
local EXHAUST_STRG = 12345
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if (getCreatureStorage(cid, EXHAUST_STRG) > os.time()) then
		--exhausted
		return false
	end
	local v, tmp = math.random(333), getCreatureOutfit(cid)
	while isInArray({tmp.lookType, 75, 135, 266, 302}, v) == TRUE or v <= 1 or (v > 160 and v < 192) or v > 333 do
		v = math.random(351)
	end
 
	tmp.lookType = v
	doCreatureChangeOutfit(cid, tmp)
	doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
	doCreatureSay(cid, 'Your outfit has been changed.', TALKTYPE_ORANGE_1, false, cid, getThingPos(cid))
	doCreatureSetStorage(cid, EXHAUST_STRG, os.time()+EXHAUST_TIME)
	return true
end
with exhaustion

Thank you, i tested it, and the exhaustion does work, but there still the same problem that they do lose hitpoints & mana points when they go back to their normal outfits, when this happen, and when they heal, their hp & mana increase :s what could this be?

here is my outfits.xml
XML:
<?xml version="1.0"?>
<outfits>
    <outfit id="1">
        <list gender="0" lookType="136" name="Citizen">
        <attribute speed="10"/>
        <stats maxHealth="100"/>
            </list>
        <list gender="1" lookType="128" name="Citizen">
        <attribute speed="10"/>
        <stats maxHealth="100"/>
            </list>
    </outfit>
 
    <outfit id="2">
        <list gender="0" lookType="137" name="Hunter">
        <skills dist="3"/>
        </list>
        <list gender="1" lookType="129" name="Hunter">
        <skills dist="3"/>
        </list>
    </outfit>
 
    <outfit id="3">
        <list gender="0" lookType="138" name="Mage">
        <stats magLevel="2"/>
        <stats maxMana="200"/>
        </list>
        <list gender="1" lookType="130" name="Mage">
        <stats magLevel="2"/>
        <stats maxMana="200"/>
        </list>
    </outfit>
 
    <outfit id="4">
        <list gender="0" lookType="139" name="Knight">
        <skills sword="3"/>
        </list>
        <list gender="1" lookType="131" name="Knight">
        <skills sword="3"/>
        </list>
    </outfit>
 
    <outfit id="5" premium="no">
        <list gender="0" lookType="140" name="Noblewoman">
        <skills club="3"/>
        </list>
        <list gender="1" lookType="132" name="Nobleman">
        <skills club="3"/>
        </list>
    </outfit>
 
    <outfit id="6" premium="no">
        <list gender="0" lookType="141" name="Summoner">
        <stats magLevel="3"/>
        <stats maxMana="200"/>
        </list>
        <list gender="1" lookType="133" name="Summoner">
        <stats magLevel="2"/>
        <stats maxMana="200"/>
        </list>
    </outfit>
 
    <outfit id="7" premium="no">
        <list gender="0" lookType="142" name="Warrior">
        <skills melee="3"/>
        </list>
        <list gender="1" lookType="134" name="Warrior">
        <skills melee="3"/>
        </list>
    </outfit>
 
    <outfit id="8" premium="no">
        <list gender="0" lookType="147" name="Barbarian">
        <skills axe="5"/>
        <skills sword="2"/>
        <skills club="2"/>
         <stats maxHealth="200"/>
        </list>
        <list gender="1" lookType="143" name="Barbarian">
        <skills axe="3"/>
        <skills sword="2"/>
        <skills club="2"/>
        <stats maxHealth="200"/>
        </list>
    </outfit>
 
    <outfit id="9" premium="no">
        <list gender="0" lookType="148" name="Druid">
        <stats magLevel="3"/>
	<absorb percentPoison="5"/>
        </list>
        <list gender="1" lookType="144" name="Druid">
        <stats magLevel="3"/>
	<absorb percentPoison="5"/>
        </list>
    </outfit>
 
    <outfit id="10" premium="no">
        <list gender="0" lookType="149" name="Wizard">
        <stats magLevel="1"/>
         <stats maxHealth="100"/>
        <stats maxMana="200"/>
	<absorb percentDeath="5"/>
        </list>
        <list gender="1" lookType="145" name="Wizard">
        <stats magLevel="1"/>
         <stats maxHealth="100"/>
        <stats maxMana="200"/>
	<absorb percentDeath="5"/>
        </list>
    </outfit>
 
    <outfit id="11" premium="no">
        <list gender="0" lookType="150" name="Oriental">
        <stats maxHealth="200"/>
        <stats maxMana="200"/>
        <attribute speed="50"/>
            </list>
        <list gender="1" lookType="146" name="Oriental">
        <stats maxHealth="200"/>
        <stats maxMana="200"/>
        <attribute speed="50"/>
            </list>
    </outfit>
 
    <outfit id="12" premium="no">
        <list gender="0" lookType="155" name="Pirate">
        <stats maxHealth="100"/>
        <skills club="5"/>
        </list>
        <list gender="1" lookType="151" name="Pirate">
        <stats maxHealth="100"/>
        <skills club="5"/>
        </list>
    </outfit>
 
    <outfit id="13" premium="no" >
        <list gender="0" lookType="156" name="Assassin">
        <attribute speed="80"/>
        <skills dist="3"/>
        <stats magLevel="2"/>
            </list>
        <list gender="1" lookType="152" name="Assassin">
        <attribute speed="80"/>
        <skills dist="3"/>
        <stats magLevel="2"/>
            </list>
    </outfit>
 
    <outfit id="14" premium="no" >
        <list gender="0" lookType="157" name="Beggar">
        <absorb percentAll="5"/>
        </list>
        <list gender="1" lookType="153" name="Beggar">
        <absorb percentAll="5"/>
        </list>
    </outfit>
 
    <outfit id="15" premium="no" >
        <list gender="0" lookType="158" name="Shaman">
        <stats magLevel="2"/>
	<absorb percentEnergy="5"/>
        </list>
        <list gender="1" lookType="154" name="Shaman">
        <stats magLevel="2"/>
	<absorb percentEnergy="5"/>
        </list>
    </outfit>
 
    <outfit id="16" premium="no" >
        <list gender="0" lookType="252" name="Norsewoman">
        <skills shielding="5"/>
	<absorb percentIce="15"/>
        <stats maxHealth="200"/>
        <skills club="3"/>
        <stats magLevel="2"/>
        </list>
        <list gender="1" lookType="251" name="Norseman">
        <skills shielding="5"/>
	<absorb percentIce="15"/>
        <stats maxHealth="200"/>
        <skills club="3"/>
        <stats magLevel="2"/>
        </list>
    </outfit>
 
    <outfit id="17" premium="no" >
        <list gender="0" lookType="269" name="Nightmare">
        <skills shielding="5"/>
	<absorb percentPhysical="15"/>
        </list>
        <list gender="1" lookType="268" name="Nightmare">
        <skills shielding="5"/>
	<absorb percentPhysical="15"/>
        </list>
    </outfit>
 
    <outfit id="18" premium="no">
        <list gender="0" lookType="270" name="Jester">
        <stats maxMana="100"/>
        <attribute speed="50"/>
        <stats maxHealth="100"/>
        </list>
        <list gender="1" lookType="273" name="Jester">
        <stats maxMana="100"/>
        <attribute speed="50"/>
        <stats maxHealth="100"/>
        </list>
    </outfit>
 
    <outfit id="19" premium="no">
        <list gender="0" lookType="279" name="Brotherhood">
        <stats magLevel="3"/>
	<absorb percentDeath="5"/>
        <stats maxHealth="100"/>
        </list>
        <list gender="1" lookType="278" name="Brotherhood">
        <stats magLevel="3"/>
	<absorb percentDeath="5"/>
        <stats maxHealth="100"/>
        </list>
    </outfit>
 
    <outfit id="20" premium="no" >
        <list gender="0" lookType="288" name="Demonhunter">
        <attribute speed="10"/>
        <stats maxHealth="300"/>
	<absorb percentFire="5"/>
        </list>
        <list gender="1" lookType="289" name="Demonhunter">
        <attribute speed="10"/>
        <stats maxHealth="300"/>
	<absorb percentFire="5"/>
        </list>
    </outfit>
 
    <outfit id="21" premium="no" >
        <list gender="0" lookType="324" name="Yalaharian">
        <attribute speed="20"/>
        <stats magLevel="2"/>
        <stats maxHealth="250"/>
        <stats maxMana="250"/>
        </list>
        <list gender="1" lookType="325" name="Yalaharian">
        <attribute speed="20"/>
        <stats magLevel="2"/>
        <stats maxHealth="250"/>
        <stats maxMana="250"/>
        </list>
    </outfit>

    <outfit id="22" premium="no">
        <list gender="0" lookType="336" name="Warmaster">
        <stats maxMana="200"/>
        <stats maxHealth="200"/>
        <stats magLevel="2"/>
	<absorb percentHoly="5"/>
        </list>
        <list gender="1" lookType="335" name="Warmaster">
        <stats maxMana="200"/>
        <stats maxHealth="200"/>
        <stats magLevel="2"/>
	<absorb percentHoly="5"/>
        </list>
    </outfit>

	<outfit id="23" premium="no">
		<list gender="0" lookType="366" name="Wayfarer"/>
		<list gender="1" lookType="367" name="Wayfarer"/>
	</outfit>

	<outfit id="24" premium="no" default="0">
		<list gender="0" lookType="329" name="Wedding"/>
		<list gender="1" lookType="328" name="Wedding"/>
	</outfit>

	<outfit id="25" access="5" premium="no">
		<list gender="0-3" lookType="12" name="Archdemon"/>
	</outfit>

	<outfit id="26" access="5" premium="no">
		<list gender="0-3" lookType="159" name="Elf"/>
	</outfit>

	<outfit id="27" access="5" premium="no">
		<list gender="0-3" lookType="160" name="Dwarf"/>
	</outfit>

	<outfit id="28" access="5" premium="no">
		<list gender="0-3" lookType="226" name="Frog"/>
	</outfit>

	<outfit id="29" access="5" premium="no">
		<list gender="0-3" lookType="194" name="Cult"/>
	</outfit>

	<outfit id="30" access="5" premium="no">
		<list gender="0-3" lookType="253" name="Headsplitter"/>
	</outfit>

	<outfit id="31" access="5" premium="no">
		<list gender="0-3" lookType="254" name="Skullhunter"/>
	</outfit>

	<outfit id="32" access="5" premium="no">
		<list gender="0-3" lookType="255" name="Bloodwalker"/>
	</outfit>

	<outfit id="33" access="5" premium="no">
		<list gender="0-3" lookType="264" name="Brutetamer"/>
	</outfit>

	<outfit id="34" access="3" premium="no">
		<list gender="0-3" lookType="75" name="Gamemaster"/>
	</outfit>

	<outfit id="35" access="4" premium="no">
		<list gender="0-3" lookType="266" name="Community Manager"/>
	</outfit>

	<outfit id="36" access="5" premium="no">
		<list gender="0-3" lookType="302" name="God"/>
	</outfit>
</outfits>
 
Back
Top