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

Simple Lever transforms item

ziggy46802

Active Member
Joined
Aug 19, 2012
Messages
418
Reaction score
27
Well what I want this to do is have a lever, with the action id "3333" since I have multiples of these levers, and when you pull this lever, it changes 100 gold coins into 1 platinum coin. Kind of like the old old banker npc but using levers to do it instead. The script works fine but if you have just a pile of, say 4 gold coins, it will change those 4 into 1 platinum coin instead of removing 100 it just takes the 4? What did I do wrong in this script, why can players just make stacks of 1 gold and turn them into platinum coins?

Code:
function onUse(cid, item, frompos, item2, topos)
	if item.actionid == 3333 then
		if getPlayerItemCount(cid, ITEM_GOLD_COIN) >= 100
			and doPlayerRemoveItem(cid, ITEM_GOLD_COIN, 100)
				then doPlayerAddItem(cid, ITEM_PLATINUM_COIN, 1)
			if getPlayerItemCount(cid, ITEM_GOLD_COIN) < 100
				then doSendMagicEffect(frompos, CONST_ME_POFF)
		end			
		end
			return true
		end
		end
 
More easy config :p
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
		if getPlayerItemCount(cid, 2148) >= 100 then
			doPlayerRemoveItem(cid,2148,100)
			doPlayerAddItem(cid,2152,100)
                        doSendMagicEffect(getPlayerPosition(cid), 13)			
		end
	return true
end

LUA:
<action actionid="x" script="name.lua"/>
Add actionid in lever - RME
 
Thank you, it's still acting up but I think thats just a problem with my character or something because it never did this before when I tested it and it only does it once, it takes his 4 gold coins and turns it into a platinum coin but then if i change a platinum back into 100 gold, it only gives me 4 (like.... what? where is it storing that I had 4 gold?) since I have 4 scripts to change money.

Anyway, it only does it once, then if I try to "cheat" again by getting my 4 back and putting it on the ground, putting 1 gold in my backpack, it does turn it into a platinum coin, but then if I put another gold coin off the floor into my backpack and try it again it poofs on me.

Gave you rep for it though since you did help me

EDIT-> its not happening on my other character so I just think my server went crazy on me for that character or something, the script works perfectly fine now.
 
Back
Top