• 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 Item attack 0.3.6

Xleniz

New Member
Joined
Jul 6, 2009
Messages
178
Reaction score
3
Location
Sweden
I'm trying to make a script that:

1. copies a players weapon and shield
2. creates this weapon and shield in staffs/cms backpack
3. gets attack of players weapon and shield
4. sets attack of the copied weapon and shield.

and I tried a lot of functions, but I can't set the attack.

Heres script:
Code:
function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return true
	end
	local target = getPlayerByNameWildcard(param)
	if(not target) then
		target = getCreatureByName(param)
		if(not target) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
			return true
		end
	end
	item1 = getPlayerSlotItem(target, 5)
	item2 = getPlayerSlotItem(target, 6)
	rew1 = doCopyItem(item1, FALSE)
	rew2 = doCopyItem(item2, FALSE)
	itemm1 = doPlayerAddItem(cid, rew1.itemid)
	itemm2 = doPlayerAddItem(cid, rew2.itemid)
	doItemSetAttribute(itemm1.uid, "attack", getItemAttribute(item1, "attack"))
	doItemSetAttribute(itemm2.uid, "attack", getItemAttribute(item2, "attack"))

	return true
end

Thx for help
 
Nvm, I fixed it xD

If anyone need script, change
Code:
	doItemSetAttribute(itemm1.uid, "attack", getItemAttribute(item1, "attack"))
	doItemSetAttribute(itemm2.uid, "attack", getItemAttribute(item2, "attack"))

to:

Code:
	doItemSetAttribute(itemm1, "attack", getItemAttribute(item1.uid, "attack"))
	doItemSetAttribute(itemm2, "attack", getItemAttribute(item2.uid, "attack"))

(its talkaction script)
 
Back
Top