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

Next script problem

Darqneez

ShaC-Ohhhh
Joined
Dec 30, 2009
Messages
72
Reaction score
2
Location
Poland/Wroclaw
hello, I'd like to change this script made by wesoly136
local rune = {cost = 6500, item_id = 2268, item_id_count = 100, count = 1, drop = false}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerMoney(cid) >= rune.cost then
if doPlayerAddItem(cid, rune.item_id,rune.item_id_count,false) then
doPlayerRemoveMoney(cid, rune.cost)
doPlayerAddItem(cid, rune.item_id,rune.item_id_count,false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought a sudden death rune.")
else
doPlayerSendTextMessage (cid, MESSAGE_INFO_DESCR, "You don\'t have enough container")
end
else
doPlayerSendTextMessage (cid, MESSAGE_INFO_DESCR, "You don\'t have enough money")
end
end
to script which creates a backpack filled with potions.
I tried to make my own script but it doesnt work. Can someone help me? Here's my not working script:
local rune = {cost = 3800, item_id = 7591, item_id_count = 1, count = 20, drop = false, bp_id = 2000}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerMoney(cid) >= rune.cost then
local new_container = doCreateItemEx(cid, rune.bp_id, 1)
if doAddContainerItem(new_container, rune.item_id,rune.item_id_count,false) then
doPlayerRemoveMoney(cid, rune.cost)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought backpack filled with great health potions.")
else
doPlayerSendTextMessage (cid, MESSAGE_INFO_DESCR, "You don\'t have enough capacity")
end
else
doPlayerSendTextMessage (cid, MESSAGE_INFO_DESCR, "You don\'t have enough money")
end
end
 
Code:
local rune = {cost = 3800, id = 7591, count = 1, bp = 2000}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerMoney(cid) >= rune.cost then
		if getPlayerFreeCap(cid) >= getItemInfo(rune.id).weight * getItemInfo(rune.bp).maxItems + getItemInfo(rune.bp).weight then
			local v = doCreateItemEx(rune.bp)
			for i = 1, getContainerCap(v) do
				doAddContainerItem(v, rune.id, rune.count)
			end
			if doPlayerAddItemEx(cid, v) == 1 then
				doPlayerRemoveMoney(cid, rune.cost)
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought a backpack filled with " .. getItemInfo(rune.id).plural .. ".")
			else
				doPlayerSendTextMessage (cid, MESSAGE_INFO_DESCR, "You don't have enough free space.")
			end
		else
			doPlayerSendTextMessage (cid, MESSAGE_INFO_DESCR, "You don't have enough capacity.")
		end
	else
		doPlayerSendTextMessage (cid, MESSAGE_INFO_DESCR, "You don't have enough money")
	end
	return true
end
 
Last edited:
Code:
local rune = {cost = 3800, id = 7591, count = 1, bp = 2000}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerMoney(cid) >= rune.cost then
		local v = doCreateItemEx(rune.bp)
		for i = 1, getContainerCap(v) do
			doAddContainerItem(v, rune.id, rune.count)
		end
		if doPlayerAddItemEx(cid, v) == 1 then
			doPlayerRemoveMoney(cid, rune.cost)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought a backpack filled with " .. getItemInfo(rune.id).plural .. ".")
		else
			doPlayerSendTextMessage (cid, MESSAGE_INFO_DESCR, "You don't have enough capacity or free space.")
		end
	else
		doPlayerSendTextMessage (cid, MESSAGE_INFO_DESCR, "You don't have enough money")
	end
	return true
end
hunted
 
Back
Top