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

Script

gurden

i need support for my server, good scripter!
Joined
May 19, 2009
Messages
519
Reaction score
5
Location
Sweden
I wonder if anyone know a script that does like this.


I have like 1 ham and some holes over. Can i make so you have to pay to get ham there by just clicking over the holes? It gonna work like a food stone but you have to pay to get :P

 
Last edited:
LUA:
local config = {
	actionid = 20000,
	itemid = 2671,
	amount = 1,
	price = 5
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.actionid == config.actionid then
		if getPlayerMoney(cid) >= config.price then
			if getPlayerFreeCap(cid) >= getItemWeightById(config.itemid, config.amount) then
				local itemToAdd = doCreateItemEx(config.itemid, config.amount)
				if doPlayerAddItemEx(cid, itemToAdd, 0) == TRUE then
					if config.amount > 1 then
						doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Bought " .. config.amount .. "x " .. getItemDescriptions(config.itemid).plural .. " for " .. config.price .. " gold.")
					else
						doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Bought " .. config.amount .. "x " .. getItemNameById(config.itemid) .. " for " .. config.price .. " gold.")
					end
					doPlayerRemoveMoney(cid, config.price)
				else
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have no room to take it.")
				end
			else
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have enough capacity, " .. config.amount .. " " .. getItemDescriptions(config.itemid).plural .. " weigh " .. getItemWeightById(config.itemid, config.amount) .. " oz.")
			end
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have enough money, " .. config.amount .. " " .. getItemDescriptions(config.itemid).plural .. " cost " .. config.price .. " gold.")
		end
	else
		return FALSE
	end
	return TRUE
end
 
Last edited:
Code:
Cannot load script (data/actions/scripts/clickfood.lua)
[03/09/2009 14:04:15] data/actions/scripts/clickfood.lua:4: '}' expected (to close '{' at line 2) near 'itemid'

???
 
0.3.5

I fixed so it worked but when ppl dident have cap it bugged up and lagged the server...

[04/09/2009 17:09:23] data/actions/scripts/clickfood.lua:24: attempt to index a boolean value
[04/09/2009 17:09:23] stack traceback:
[04/09/2009 17:09:23] data/actions/scripts/clickfood.lua:24: in function <data/actions/scripts/clickfood.lua:8>
 
Last edited by a moderator:
Back
Top