• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[Request Help] Wrong in the script

tosse12

Panchira Project Member
Joined
Jun 10, 2007
Messages
864
Reaction score
9
Location
Sweden
okey I will go right on the problem...

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 2275 then
	doPlayerRemoveItem(cid,2275,1)
		doPlayerAddItem(cid, 2229, 6)
		doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_TEAL)
	else
		return FALSE
	end
	return TRUE
end
As you see I want to remove a item and then add a other item... (I guess you understand) but it won't remove that item when I use it... whats wrong with the script?

Well while I ask this I can ask a other question...
How do I do to use Scarab coin as money, like: 100cc = 1 scarab coin, and when I shop I can use that scarab coin to buy items with.
Well I mean dose it change to cc, pc or gc, when I shoping with scarab coin, or do I need to make a kind of script for it?
 
Ok try this one :D

function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 2275 then
if getPlayerItem(cid, 2275) >= 1 then
doPlayerRemoveItem(cid, 2275, 1)
doPlayerAddItem(cid, 2229, 6)
doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_TEAL)
else
doPlayerSendCancel(cid, "You don\'t have this item")
end
else
return FALSE
end
return TRUE
end
 
Okey I am getting an error when I use it:
Code:
21/08/2008  17:02:36] Lua Script Error: [Action Interface] 
[21/08/2008  17:02:36] data/actions/scripts/other/60token.lua:onUse

[21/08/2008  17:02:36] data/actions/scripts/other/60token.lua:3: attempt to call global 'getPlayerItem' (a nil value)
[21/08/2008  17:02:36] stack traceback:
[21/08/2008  17:02:36] 	data/actions/scripts/other/60token.lua:3: in function <data/actions/scripts/other/60token.lua:1>
 
hmm, maybe?

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 2275 then
if getPlayerItemCount(cid, 2275) >= 1 then
doPlayerTakeItem(cid, 2275, 1)
doPlayerAddItem(cid, 2229, 6)
doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_TEAL)
else
doPlayerSendCancel(cid, "You don\'t have this item")
end
end
end

second request, I don't know, I testing trunk now, if you want make this in trunk you need source edit, cuz there are functions doPlayerRemoveMoney, doPlayerRemoveMoney, they are insource I think. dunno for tags ;d
 
Last edited:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 2275 then
		doRemoveItem(item.uid, 1)
		doPlayerAddItem(cid, 2229, 6)
		doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_TEAL)
	else
		return FALSE
	end
	return TRUE
end
 
Back
Top