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

Buy script

Joined
Jun 19, 2009
Messages
1,852
Reaction score
5
Hello!

I want to do a similar script to the "rune seller script", where you click on a lever and you receive an item.

I couldn't modify the script because JDB's scripts are always confusing (no offense man XD.)

Ok, so I have 17 different levers and all of them have different unique id's (from 60000 to 60016), and if you click one of the items you receive different items depending on the lever (depending on the unique id)

I hope you understand what I'm trying to request :P

thanks!
 
It's Cykotitan and Xeon, they can do anything. I mean anythiiiing... Wouldn't be surprised if they had higher authority than Talaturen and Kornholjio...
 
Code:
local t = {
	[60000] = {cost = 5000, id = 2268, count = 3},
	[60001] = {cost = 3000, id = 2273, count = 3}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local v = t[item.uid]
	local weight = getItemWeightById(v.id, v.count)
	if getPlayerFreeCap(cid) >= weight then
		if getPlayerMoney(cid) >= v.cost then
			local thing = doCreateItemEx(v.id, v.count)
			if doPlayerAddItemEx(cid, thing) ~= 1 then
				doPlayerSendCancel(cid, "You don't have enough space.")
			else
				doPlayerRemoveMoney(cid, v.cost)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have bought " .. (v.count > 1 and v.count or getItemInfo(v.id).article) .. " " .. (v.count > 1 and getItemInfo(v.id).plural or getItemInfo(v.id).name) .. ".")
				return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
			end
		else
			doPlayerSendCancel(cid, "You need to have " .. v.cost .. " gold.")
		end
	else
		doPlayerSendCancel(cid, "You need atleast " .. weight:format("%.2f") .. " oz. of free capacity.")
	end
	return doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end
It's Cykotitan and Xeon, they can do anything. I mean anythiiiing... Wouldn't be surprised if they had higher authority than Talaturen and Kornholjio...
^
 
I suppose the body of my scripts are difficult to understand, but all my configs are pretty basic knowledge.
 
JDB, if someone wants to use your version its easy as hell, but editing core of script can be difficult

ofc Cykotitans can be even harder sometimes :D
 
Back
Top