• 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 Help me with an action script

axas

Well-Known Member
Joined
Feb 23, 2008
Messages
870
Reaction score
94
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1054 then
doPlayerAddItem(cid,2173,1)
	else 
	doPlayerSendTextMessage(cid,22,"You can't mine this.")
return TRUE
end

I want it to give player 2173 item id when you use a pick on 1054 item id.
Also would be good if it removed the 2173 and respawned it at the same spot in 120 seconds.
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if (itemEx.itemid == 1054  and  item.itemid == pick id then
doPlayerAddItem(cid,2173,1)
    else 
    doPlayerSendTextMessage(cid,22,"You can't mine this.")
return TRUE
end
change the pick id
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if (itemEx.itemid == 1054  and  item.itemid == pick id then
doPlayerAddItem(cid,2173,1)
    else 
    doPlayerSendTextMessage(cid,22,"You can't mine this.")
return TRUE
end
change the pick id
won't work
 
Lua:
local time = 120
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if itemEx.itemid == 1054 and itemEx.actionid == 1111 then
		doPlayerAddItem(cid, 2173, 1)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Mining was sucessful")
		doTransformItem(itemEx.uid, 460, 1)
		doDecayItem(460, 1) time)
	end
		else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "add me in facebook brooh plix")
end

I've got no fawking idea if it'll work, I was half asleep. Try it

I added actionid to mine, would be a little sad if it worked on every wall u did it on..
 
Last edited:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if itemEx.itemid == 1054 then
		doPlayerAddItem(cid, 2173, 1)
		doRemoveItem(itemEx.uid)
		addEvent(doCreateItem, 120 * 1000, itemEx.itemid, 1, toPosition)
	else 
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You can\'t mine this.')
	end
	return true
end
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if itemEx.itemid == 1054 then
		doPlayerAddItem(cid, 2173, 1)
		doRemoveItem(itemEx.uid)
		addEvent(doCreateItem, 120 * 1000, itemEx.itemid, 1, toPosition)
	else 
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You can\'t mine this.')
	end
	return true
end

Where is the pick? It should be in the script too right?
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if itemEx.itemid == 1054 then
		doPlayerAddItem(cid, 2173, 1)
		doRemoveItem(itemEx.uid)
		addEvent(doCreateItem, 120 * 1000, itemEx.itemid, 1, toPosition)
	else 
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You can\'t mine this.')
	end
	return true
end

seems to drop the error message even if the item id I'm mining is correct :<

actions.xml:
<action itemid="2553" event="script" value="tools/pick.lua"/>
 
Works here :p

Ah, i had item.itemid instead of itemEx.itemid. Why is it Ex though?


and why doesn't the variable work instead of the ids? :<
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local minables = {1356, 1357, 1358}
	if itemEx.itemid == minables then
			doPlayerAddItem(cid,2173,1)
			doRemoveItem(itemEx.uid)
			addEvent(doCreateItem, 5 * 1000, itemEx.itemid, 1, toPosition)
	else 
			doPlayerSendTextMessage(cid,22,"You can\'t mine this.")
		end
		return TRUE
end
 
Ah, i had item.itemid instead of itemEx.itemid. Why is it Ex though?


and why doesn't the variable work instead of the ids? :<
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local minables = {1356, 1357, 1358}
	if itemEx.itemid == minables then
			doPlayerAddItem(cid,2173,1)
			doRemoveItem(itemEx.uid)
			addEvent(doCreateItem, 5 * 1000, itemEx.itemid, 1, toPosition)
	else 
			doPlayerSendTextMessage(cid,22,"You can\'t mine this.")
		end
		return TRUE
end

itemEx is second item that you use first item on, like you use shovel on sand then sand is itemeEx :p

This:
Code:
local minables = {1356, 1357, 1358}
	if itemEx.itemid == minables then

Should be:
Code:
local minables = {1356, 1357, 1358}
	if isInArray(minables, itemEx.itemid) then
 
Back
Top