• 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 Change color outfit randomly

Jetro

jangeldev
Joined
Aug 1, 2011
Messages
452
Reaction score
68
Location
Venezuela
Hi all, this is simple script but maybe someone could use it. Basically it changes the color of head, body, legs and feet to a random color xD


Lua:
local config = {
	needPremium = true, --Need premium?
	needMoney = 25000, --Need Money?  if need put the money needed or it doesn't put false if it won't need money
	makeExhaustion = 5, --make exhaust? put the exhaust time in seconds or false if it won't make exhaustion
	exhaustionStorage = 3232, --storage for save the exhausted.
	effect = CONST_ME_BLOCKHIT, --will send an effect? if it will do it put the effect number here or false if it won't 
	msg = "ASD", -- message it will send
	type = MESSAGE_INFO_DESCR, --the type of msg it will send , here you can see the types :
	
	--[[MESSAGE_EVENT_ADVANCE,
	MESSAGE_EVENT_DEFAULT,
	MESSAGE_STATUS_CONSOLE_ORANGE,
	MESSAGE_INFO_DESCR,
	MESSAGE_STATUS_SMALL,
	MESSAGE_STATUS_CONSOLE_BLUE,
	MESSAGE_STATUS_CONSOLE_RED,
	MESSAGE_STATUS_WARNING,  
	you can see it too in lib/constant.lua :d ]] -- 
}

function onSay(cid, words, param, channel)

	if (exhaustion.get (cid, config.exhaustionStorage)) then
		return doPlayerSendCancel (cid, "Wait "..exhaustion.get (cid, config.exhaustionStorage).. " seconds to do it again.")
	end
	if (config.needPremium and isPremium (cid) == false) then
		return doPlayerSendCancel(cid, "You need premium to use this command.")
	end
	
	if (config.needMoney ~= false and tonumber(config.needMoney) and doPlayerRemoveMoney(cid, config.needMoney) == false ) then
		return doPlayerSendCancel (cid, "You need "..config.needMoney.. " to use this command.")
	end
		
	if (config.makeExhaustion ~= false and tonumber(config.makeExhaustion)) then
		exhaustion.set (cid, config.exhaustionStorage, config.makeExhaustion)
	end
		
	if (config.effect ~= false and tonumber(config.effect)) then
		local pos = getThingPos(cid)
		doSendMagicEffect(pos, config.effect)
	end
		
	if (config.msg ~= false) then
		doPlayerSendTextMessage(cid, config.type, config.msg)
	end
	
	local out = getCreatureOutfit(cid)
		doCreatureChangeOutfit (cid, {lookType = out.lookType, lookHead = math.random(132) , lookBody = math.random(132), lookLegs = math.random(132), lookFeet = math.random(132), lookAddons = out.lookAddons } ) 
	return true
end

XML:
<talkaction words="!color;/color" event="script" value="nameofyourscript.lua"/>

tested on tfs 0.3.6pl1 and 0.4
 
Last edited:
Would be great if you made this so, when the player logs in for the first time he gets a random outfit :)
 
Would be great if you made this so, when the player logs in for the first time he gets a random outfit :)
just add 2 lines in login
Lua:
local out = getCreatureOutfit(cid)
		doCreatureChangeOutfit (cid, {lookType = out.lookType, lookHead = math.random(132) , lookBody = math.random(132), lookLegs = math.random(132), lookFeet = math.random(132), lookAddons = out.lookAddons } )
 
Back
Top