I tried to make a new function called 'setPartyStorage' that give a storage value to all party members (include the leader, ofc), but I don't have to much knowledge, so, I need you help to make it work.
The problem is that I try to get all members, but I'm unsuccessful.
Here are my try:
Thank you in advance.
The problem is that I try to get all members, but I'm unsuccessful.
Here are my try:
Lua:
function setPartyStorage(pt, key, value)
local pt = getPlayerParty(cid)
local memb = getPartyMembers(pt)
local pid = getPlayerGUID(cid)
for _, pid in pairs(memb) do
local getvalue = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = " .. pid .. " and `key` = " .. key .. " LIMIT 1;")
if(getvalue:getID() ~= -1) then
db.executeQuery("UPDATE `player_storage` SET `value` = " .. pid .. " WHERE `key`=" .. key .. " LIMIT 1');")
getvalue:free()
return
else
db.executeQuery("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (" .. pid .. ", " .. key .. ", '"..value.."');")
return
end
end
end
Thank you in advance.