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

Znote shop system

nevix

Tunzodus.net
Joined
Mar 31, 2010
Messages
356
Reaction score
62
Location
Lithuanian
I need help with shop system when i bought item its be: znote_shop_orders

in talkactions: i added:

<talkaction words="!shop" script="shop.lua"/>

My lua:



Lua:
function onSay(cid, words, param)
	local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
	local cooldown = 15 -- in seconds.
 
	if getPlayerStorageValue(cid, storage) <= os.time() then
		setPlayerStorageValue(cid, storage, os.time() + cooldown)
		local accid = getAccountNumberByPlayerName(getCreatureName(cid))
 
		-- Create the query
		local orderQuery = db.storeQuery("SELECT `id`, `type`, `itemid`, `count` FROM ` znote_shop_orders ` WHERE `account_id` = " .. accid .. " LIMIT 999;")
 
		-- Detect if we got any results
		if orderQuery ~= false then
			-- Fetch order values
			local q_id = result.getDataInt(orderQuery, "id")
			local q_type = result.getDataInt(orderQuery, "type")
			local q_itemid = result.getDataInt(orderQuery, "itemid")
			local q_count = result.getDataInt(orderQuery, "count")
			result.free(orderQuery)
 
			-- ORDER TYPE 1 (Regular item shop products)
			if q_type == 1 then
				-- Get wheight
				local playerCap = getPlayerFreeCap(cid)
				local itemweight = getItemWeightById(q_itemid, q_count)
					if playerCap >= itemweight then
						db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
						doPlayerAddItem(cid, q_itemid, q_count)
						doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have recieved ".. q_count .." "..getItemNameById(q_itemid).."(s)!")
					else
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Need more CAP!")
					end
			end
			-- Add custom order types here
			-- Type 2 is reserved for premium days and is handled on website, not needed here.
			-- Type 3 is reserved for character gender(sex) change and is handled on website as well.
			-- So use type 4+ for custom stuff, like etc packages.
			-- if q_type == 4 then
			-- end
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have no orders.")
		end
 
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Can only be executed once every "..cooldown.." seconds. Remaining cooldown: ".. getPlayerStorageValue(cid, storage) - os.time())
	end
	return false
end

error:
Warning: [Event::checkScript] Can not load script. /scripts/shop.lua
cannot open data/talkactions/scripts/shop.lua: No such file or directory
 
Last edited by a moderator:
Would have saved you some time, to read the error insted of posting it here, Just saying..
Like I said yesterday, 3 years and still?
WibbenZ
 
[14/6/2013 19:19:53] mysql_real_query(): SELECT `id`, `type`, `itemid`, `count` FROM ` znote_shop_orders ` WHERE `account_id` = 3 LIMIT 999; - MYSQL ERROR: Incorrect table name ' znote_shop_orders ' (1103)
Please help, I use Znote Aac
 
Last edited:
Back
Top