LUA - More stable shopsystem

When working with custom types.
This commit is contained in:
Znote
2020-03-19 22:38:51 +01:00
parent 0c64adb55e
commit 0eb2972e30
5 changed files with 57 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
-- Znote Shop v1.0 for Znote AAC on TFS 0.2.13+ Mystic Spirit.
-- Znote Shop v1.1 for Znote AAC on TFS 0.2.13+ Mystic Spirit.
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.
@@ -12,7 +12,9 @@ function onSay(cid, words, param)
"pending premium (skip)",
"pending gender change (skip)",
"pending character name change (skip)",
"Outfit and addons"
"Outfit and addons",
"Mounts",
"Instant house purchase"
}
print("Player: " .. getCreatureName(cid) .. " triggered !shop talkaction.")
-- Create the query
@@ -26,7 +28,12 @@ function onSay(cid, words, param)
local q_type = result.getDataInt(orderQuery, "type")
local q_itemid = result.getDataInt(orderQuery, "itemid")
local q_count = result.getDataInt(orderQuery, "count")
print("Processing type "..q_type..": ".. type_desc[q_type])
local description = "Unknown or custom type"
if type_desc[q_type] ~= nil then
description = type_desc[q_type]
end
print("Processing type "..q_type..": ".. description)
-- ORDER TYPE 1 (Regular item shop products)
if q_type == 1 then
@@ -78,8 +85,9 @@ function onSay(cid, words, param)
-- Type 4 is for character name change (Coded on web)
-- Type 5 is for character outfit and addon (Already coded here)
-- Type 6 is for mounts (Not for TFS 0.2)
-- So use type 7+ for custom stuff, like etc packages.
-- if q_type == 7 then
-- Type 7 is for Instant house purchase (Not for TFS 0.2)
-- So use type 8+ for custom stuff, like etc packages.
-- if q_type == 8 then
-- end
result.free(orderQuery)
if not served then