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

MoveEvent Onequip add addon

Ataro

Member
Joined
Oct 28, 2010
Messages
689
Reaction score
19
Location
Netherlands
Hey, this is an small tutorial how to add addons on equip item.

Brown backpack = Citizen backpack:

data/movements/scripts/citizenbackpack.lua

Lua:
function onEquip(cid, item, slot)
	if getPlayerSex(cid) == 1 then
		doPlayerAddOutfit(cid, 128, 1)
	elseif getPlayerSex(cid) == 2 then
		doPlayerAddOutfit(cid,136, 1)
	end
end	

function onDeEquip(cid, item, slot)
	if getPlayerSex(cid) == 1 then
		doPlayerRemoveOutfit(cid,128, 1)
	elseif getPlayerSex(cid) == 2 then
		doPlayerRemoveOutfit(cid,136, 1)
	end
end

data\movements\movements.xml at the end add:
XML:
<movevent event="Equip" itemid="1988" function="onEquipItem" slot="backpack" script="citizenbackpack.lua"/>
<movevent event="DeEquip" itemid="1988" function="onDeEquipItem" slot="backpack" script="citizenbackpack.lua"/>


Brutus Bloodbeard's Hat = Citizen Hat Addon
citizenhat.lua
Lua:
function onEquip(cid, item, slot)
	if getPlayerSex(cid) == 1 then
				doPlayerAddOutfit(cid, 128, 2)
	elseif getPlayerSex(cid) == 2 then
				doPlayerAddOutfit(cid,136, 2)
	end
end	

function onDeEquip(cid, item, slot)
	if getPlayerSex(cid) == 1 then
		doPlayerRemoveOutfit(cid,128, 2)
	elseif getPlayerSex(cid) == 2 then
		doPlayerRemoveOutfit(cid,136, 2)
	end
end

movements.xml:

XML:
<movevent event="Equip" itemid="6099" function="onEquipItem" slot="backpack" script="citizenhat.lua"/>
<movevent event="DeEquip" itemid="6099" function="onDeEquipItem" slot="backpack" script="citizenhat.lua"/>
 
Last edited:
  1. There is doPlayerRemoveOutfit function??
  2. Fail copy in citizenhat.lua --> [function onEquip(cid, item, slot)]
  3. To much tabs


Don't get me wrong. This tips should to help you in creating next scripts.
 
Did i say its tfs 0,4? ;) But :O

@VirrageS Edited all you said ;) Done now :)

@Stewie mayby because the remove function was bugged? :p i cant try at 0.4
 
Last edited:
in tfs 0.3.6 you cannot use onEquip function. It will crash your server.
 
Something wrong with your tfs? it normally should work, i used tfs 0.3.6 before and yes i used onequip ;S
 
:S I dont like to bump i like to get peoples reaction!
This scripts is pretty good whats the problem!
 
why peapols should comment? just take script, thats all, i dont see any point to comment there.
 
Its nice so people comment something like that then my script stays on top and more people can enjoy it!
 
PHP:
doPlayerAddOutfit(cid,looktype, addon)
	doPlayerRemoveOutfit(cid,looktype[, addon = 0])

in tfs 0.4 exist this function D:!
 
Back
Top