Well as the thread title states I need some help with a function.
I know the main problem is in the keys:getDataInt as I that's the error I'm getting in the console (result is not being set)
and I don't really know how to use db functions, just going off other examples..
I think its pretty self-explanatory on what its supposed to do.
Some help anybody? :$ (I'd love an explanation too)
p.s. sorry for not using LUA tags, it capitalizes a bunch of the script for some reason..
Code:
function setGuildStorage(cid, key, value)
db.query("DELETE FROM `guild_storage` WHERE `guild_id` ='" .. getPlayerGuildId(cid) .. "' AND `key` ='" .. key .. "';")
db.query("INSERT INTO `guild_storage` VALUES (" .. getPlayerGuildId(cid) .. "," .. key .."," .. value .. ");")
end
-------------
function getGuildStorage(cid, key)
local keys = db.getResult("SELECT `value` FROM `guild_storage` WHERE `guild_id` = '" .. getPlayerGuildId(cid) .. "' AND `key` = '" .. key .. "'")
if keys:getID() ~= -1 then
keys:free()
end
return keys:getDataInt("value")
end
and I don't really know how to use db functions, just going off other examples..
I think its pretty self-explanatory on what its supposed to do.
Some help anybody? :$ (I'd love an explanation too)
p.s. sorry for not using LUA tags, it capitalizes a bunch of the script for some reason..
Last edited: