TFS 1.1+ shop talkaction fix by @kushovu Fix #200

This commit is contained in:
Znote 2016-10-24 01:37:31 +02:00
parent 21e0de50b4
commit ee11674450

View File

@ -1,8 +1,7 @@
-- Znote Shop v1.0 for Znote AAC on TFS 1.0+.
function onSay(cid, words, param)
-- Znote Shop v1.0 for Znote AAC on TFS 1.1
function onSay(player, 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.
local player = Player(cid)
if player:getStorageValue(storage) <= os.time() then
player:setStorageValue(storage, os.time() + cooldown)
@ -13,10 +12,10 @@ function onSay(cid, words, param)
-- 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")
local q_id = result.getNumber(orderQuery, "id")
local q_type = result.getNumber(orderQuery, "type")
local q_itemid = result.getNumber(orderQuery, "itemid")
local q_count = result.getNumber(orderQuery, "count")
result.free(orderQuery)
-- ORDER TYPE 1 (Regular item shop products)
@ -43,4 +42,4 @@ function onSay(cid, words, param)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Can only be executed once every " .. cooldown .. " seconds. Remaining cooldown: " .. player:getStorageValue(storage) - os.time())
end
return false
end
end