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

Action: lever script help

YugiNao

Banned User
Joined
Nov 22, 2008
Messages
211
Reaction score
3
My lever doesn't work ingame gives error in console to,
This is how i added it.

Code:
<action itemid="5000" event="script" value="other/lever1.lua"/>

and here is the script.

Code:
onUse(cid, item)
      if item.itemid == 1946 then
             doTransformItem(item.uid, item.itemid-1)
             return true
      end

      if item.actionid ~= 5000 then
              return true
      end
      doPlayerAddItem(cid, 2270, 1)
	  doPlayerRemoveMoney(cid, 50000)
      doTransformItem(item.uid, item.itemid+1)
      return true
end
 
Code:
      if item.actionid ~= 5000 then
              return true
      end
replace with;
Code:
      if itemEx.itemid ~= 5000 then
              return true
      end
i still have no idea wat ur trying to do :S
 
I, want my lever give me a rune and remove money from player i didnt make this myself a lua-scripter gived it to me and said it's gotta be working ...
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 or item.itemid == 1946 then
		if doPlayerRemoveItem(cid, 50000) then return doPlayerAddItem(cid, 2270, 1) or doPlayerSendCancel(cid, "You dont have enough money.") end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
try it
 
ur doing this wrong probs
Code:
<action itemid="5000" event="script" value="other/lever1.lua"/>
check this;
Code:
<action [B]uniqueid="5000"[/B] event="script" value="other/lever1.lua"/>
and put in the lever the uniqueid "5000"
 
errorconsole.png

That is the error in my console

Iam using now OzIcO's Script

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 or item.itemid == 1946 then
		if doPlayerRemoveItem(cid, 50000) then return doPlayerAddItem(cid, 2270, 1) or doPlayerSendCancel(cid, "You dont have enough money.") end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end

Actions XML

Code:
<action uniqueid="5000" event="script" value="other/lever1.lua"/>
 
errorconsole.png

That is the error in my console

Iam using now OzIcO's Script

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 or item.itemid == 1946 then
		if doPlayerRemoveItem(cid, 50000) then return doPlayerAddItem(cid, 2270, 1) or doPlayerSendCancel(cid, "You dont have enough money.") end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end

Actions XML

Code:
<action uniqueid="5000" event="script" value="other/lever1.lua"/>
wops, sorry replace;
Code:
doPlayerRemoveItem(cid, 50000)
with;
Code:
doPlayerRemoveMoney(cid, 50000)
 
It work's Great OzIcO ,can u maybe add :message with orange text tells, You bought a manarune and gets on player magic effect 31?
 
It works, OzIcO Thanks, if its not to much can add: a orange text effect which says: You bought a manarune and add magic effect number 31?
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 or item.itemid == 1946 then
		if doPlayerRemoveMoney(cid, 50000) then return doPlayerAddItem(cid, 2270, 1) and doCreatureSay(cid, "You bought a manarune for 50000 gold coins.", TALKTYPE_MONSTER) and doPlayerSendTextMessage(cid, 20, "You bought a manarune for 5000 gold coins.") and doSendMagicEffect(getThingPos(cid), 31)or doPlayerSendCancel(cid, "You dont have enough money.") end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition) return doPlayerRemoveMoney(cid, 50000) and doPlayerAddItem(cid, 2270, 1) and doCreatureSay(cid, "You bought a manarune for 50000 gold coins.", TALKTYPE_MONSTER) and doPlayerSendTextMessage(cid, 20, "You bought a manarune for 5000 gold coins.") and doSendMagicEffect(getThingPos(cid), 31) and doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945) or doPlayerSendCancel(cid, "You dont have enough money.") end
 
Back
Top