Hi all, this is a simple function to know if player has a storage in some of the players in him/her account, returns true if it has and false if hasn't. Maybe will be useful to someone. What would be an option to use it? maybe for an account quest, only a player in account can make the quest 
add this in your data/lib/050-function.lua
How to use it?
Shortened version by Cykotitan
I hope you like it :3
Regards

add this in your data/lib/050-function.lua
LUA:
function hasAccountStorage(cid, key, value)
if (not isPlayer(cid)) then
return print("CID MUST BE A PLAYER!") and false
end
if (not isNumber(key) or not isNumber(value) ) then
return print("KEY AND VALUE MUST BE NUMBERS!") and false
end
local id = db.getResult("select `account_id` from `players` where id = "..getPlayerGUID(cid)..";")
local players_list = db.getResult("select `id` from `players` where `account_id` = "..id:getDataInt("account_id")..";")
if players_list:getID() ~= -1 then
players = {}
repeat
table.insert (players, players_list:getDataInt("id"))
until not(players_list:next())
local select_stor = db.getResult ("select * from `player_storage` where `player_id` in ("..table.concat (players, ",")..") and (`key` = "..key.." and `value` = "..value..") ;")
res = select_stor:getID() > 0 and true or false
if (res) then
select_stor:free()
id:free()
players_list:free()
end
end
return res
end
How to use it?
LUA:
if ( hasAccountStorageValue(cid, 3232, 4) ) then
doPlayerSendCancel(cid, "You have already done this quest")
else
doPlayerAddItem(cid, item, count)
end
Shortened version by Cykotitan
I hope you like it :3
Regards
Last edited: