é uma função que pega o nome do leader da guild,dá para fazer algo interessante como adicionar itens ao lider da guild depois de completar um "war",etc
adicionando:
050-function
function getGuildLeaderName(GuildName) -- function by vodkart
local leader = db.getResult("SELECT `players`.`name` FROM `players` WHERE `players`.`id` = (SELECT `guilds`.`ownerid` FROM `guilds` WHERE `guilds`.`name` = ".. db.escapeString(GuildName) .. ")")
if(leader:getID() ~= -1) then
return leader:getDataString("name")
end
return nil
end
exemplo de uso em talkactions:
FLW
exemplo em actions:
function onUse(cid, item, frompos, item2, topos)
local leader,pid = getGuildLeaderName(getPlayerGuildName(cid)),getPlayerByName(leader)
local item = 2400
if getPlayerGuildId(cid) <= 0 then
return doPlayerSendCancel(cid, "You are not a guild member.")
elseif (not pid or isPlayerGhost(pid)) then
return doPlayerSendCancel(cid, "Sorry, The Leader [".. leader .."] is offline and will not receive the item!")
end
doPlayerAddItem(pid,item,1)
return TRUE
end
nesse script o jogador vai puchar a alavanca ou clicar em alguma coisa e vai ser adicionado um item para o lider da sua guild