• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ need help Player.ghguild (self)

amarelaxx

New Member
Joined
Jun 2, 2017
Messages
3
Reaction score
0
Lua:
function onUse(player, item, fromPosition, toPosition, isHotkey)

--- Create the variables ---
guild =  player:getGuild()

----- Check if it has already been invaded
if item:getId() == 9826 then
player:sendTextMessage(MESSAGE_STATUS_SMALL,"The Guild House has already been invaded today.")
return true
end

----- Check if you already have a guild -
if item:getId() == 9825 then
if guild == nil then
player:sendTextMessage(MESSAGE_STATUS_SMALL,"It is necessary to have a guild to dominate the guild house.")
return true
end
end

--- Check if his guild is already dominated ----
if item:getId() == 9825 then
if guild:getId() == Player.ghguild(self) then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "Your guild is already dominating the guild house.")
return true
end
end


----- Check the time to invade ----
if item:getId() == 9825 then
local hora = tonumber(os.date("%H"))
if hora ~= 18 then
player:sendTextMessage(MESSAGE_STATUS_WARNING, "The Guild House can only be invaded between 10 pm and 11 pm.")
return true
end
end

---- Check the monsters ----
if item:getId() == 9825 then
for posx = 1254,1256 do -- check position X, start and end of the room
for posy = 690,690 do -- check position Y, start and end of the room
local pos = Position (posx, posy, 6) - position that will check for creatures (stackpos = 253)
local creature = getTopCreature(pos).uid -- get information about the creature's position
if isMonster(creature) then -- check if it's a monster
player:sendTextMessage(MESSAGE_STATUS_WARNING, "To dominate the guild house it is necessary to kill the guards.")
return true
end
end
end
end


--- Message saying you dominated GH--
Game.broadcastMessage("The guild "..guild:getName().."just took over the Guild House of Dol \ 'Guldur!", MESSAGE_STATUS_WARNING)


--- Delete the last guild you dominated, add the new guild, and move the lever--
db.asyncQuery("DELETE FROM `gh` WHERE `guild` != 0 ")
db.asyncQuery("INSERT INTO `gh` (`guild`,`nomeguild`) VALUES (" ..guild:getId().. ",'" ..guild:getName()..".');")
doTransformItem(item.uid,item.itemid+1)
return true
end


A friend gave me these scripts to dominate the guildhouse so I need the Player.ghguild (self) function to be able to work, he checks if the character's guild is already dominated by the guild house, when someone dominates the guild house, the id is stored and the name of the guild in a table in the database. if anyone can help me create this function to pull the guild that dominates the guild house.
 
Back
Top