Hello & Welcome to our community. Is this your first visit? Register
Follow us on
Follow us on Facebook Follow us on Twitter Watch us on YouTube


MMOCoin

Likes Likes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Sergeant
    Dr. Fallen's Avatar
    Join Date
    Mar 2010
    Location
    Turkey
    Posts
    74
    Post Thanks / Like
    Rep Power
    15
    Reputation
    64

    [Lua] Guild zone system


    Register to remove this ad
    Guild zone system!

    After a few guild systems got released, 0 worked for me, I decided to make one. I have tested this, and it worked 100%.

    What this script does:

    You can buy and sell zones. For an amount of copper you decide. You can have up to 5 zones. You can't buy zones in instances or restricted area's. You can add restricted areas in the script. In those zones you own you and your guild members can do some things listed down here:




    #buy zone - To buy a zone. (Guild Master only.)
    #sell zone zoneid - To sell a zone. (Guild Master only.)
    #add tele - Add a place players can teleport to, have to be in one of the zones you own. (Guild Master only.)
    #area tele - Teleport to the place the guildmaster set.
    #zone info - Displays zone id and the status of the zone.
    #owned zones - Displays zones your guild currently owns.
    #buff - Buffs you while in a zone your guild owns.
    #commands - Shows a list of commands available for you.
    Note: This script is using Areas not zones. Reason behind this is because zones are way to big.

    You have to import this into your char DB:

    Code:
    DROP TABLE IF EXISTS `guild`;
    CREATE TABLE `guild` (
      `GuildId` int(19) default NULL,
      `Zone1` int(19) default NULL,
      `Zone2` int(19) default NULL,
      `Zone3` int(19) default NULL,
      `Zone4` int(19) default NULL,
      `Zone5` int(19) default NULL,
      `Map` int(8) default NULL,
      `PosX` float default NULL,
      `PosY` float default NULL,
      `PosZ` float default NULL
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
    And make sure you have this line added in your optional.conf.

    Code:
    <LuaHypArc AllowCharDBQueries="1">
    Script:


    PHP Code:
    GUILD = {} 

    local BuyZone "#buy zone" 
    local SellZone "#sell zone"
    local AddTele "#add tele"
    local TeleMsg "#area tele"
    local ZoneInfo "#zone info"
    local OwnedZones "#owned zones"
    local Buff "#buff"
    local Commands "#guild commands"

    local BUYPRICE 50000             -- Money needed to buy a zonein copper
    local SELLPRICE 50000            -- Money player gets when he sells a zone.

    -- 
    Add AREA ID's here players can't buySo not the zone idbut the area idYou dont have to added instancesthey are all blocked
    local NotBuyableAreas = {
        
    1741, -- Gurubashi Tribune
        2177
    , -- Gurubashi Ring
    }
        

    function 
    GUILD.ZoneCommands(eventplayermessagetypelanguage
        
    local msg message:lower(player)
        if (
    msg == BuyZone) and (player:IsInGuild() == true) and (player:GetGuildLeader() == player:GetName()) then
            
    if (GuildAreaCheck(player) == truethen
                
    if (AreaCheck(player) == truethen
                    
    if (RestrictedArea(player) == true) and (player:GetInstanceID() == nilthen
                        
    if (player:GetCoinage() >= BUYPRICEthen
                            AddArea
    (player)
                            
    player:DealGoldCost(BUYPRICE)
                            
    player:SendBroadcastMessage("You succesfully bought this zone!")
                        else
                            
    player:SendBroadcastMessage("You dont have enough gold to buy this zone.")
                        
    end
                    
    else
                        
    player:SendBroadcastMessage("This zone is not for sale.")
                    
    end    
                
    else
                    
    player:SendBroadcastMessage("This zone is already bought by a guild.")
                
    end
            
    else
                
    player:SendBroadcastMessage("Your guild already owns the maximum of allowed zones.")
            
    end
            
    return 0    
        end    
        
    if (msg:find(SellZone.." ") == 1) and (player:IsInGuild() == true) and (player:GetGuildLeader() == player:GetName()) then
            local AreaId 
    msg:gsub(SellZone.." """)
            if (
    OwnsArea(playerAreaId) == 1then
                CharDBQuery
    ("UPDATE guild SET Zone1 = '0' WHERE GuildId = '"..player:GetGuildId().."'"0)
                
    player:SendBroadcastMessage("You succesfully sold zone "..AreaId..".")
                
    player:DealGoldMerit(SELLPRICE)
            elseif (
    OwnsArea(playerAreaId) == 2then 
                CharDBQuery
    ("UPDATE guild SET Zone2 = '0' WHERE GuildId = '"..player:GetGuildId().."'"0)
                
    player:DealGoldMerit(SELLPRICE)
                
    player:SendBroadcastMessage("You succesfully sold zone "..AreaId..".")
            elseif (
    OwnsArea(playerAreaId) == 3then 
                CharDBQuery
    ("UPDATE guild SET Zone3 = '0' WHERE GuildId = '"..player:GetGuildId().."'"0)
                
    player:SendBroadcastMessage("You succesfully sold zone "..AreaId..".")
                
    player:DealGoldMerit(SELLPRICE)
            elseif (
    OwnsArea(playerAreaId) == 4then 
                CharDBQuery
    ("UPDATE guild SET Zone4 = '0' WHERE GuildId = '"..player:GetGuildId().."'"0)
                
    player:SendBroadcastMessage("You succesfully sold zone "..AreaId..".")
                
    player:DealGoldMerit(SELLPRICE)
            elseif (
    OwnsArea(playerAreaId) == 5then 
                CharDBQuery
    ("UPDATE guild SET Zone5 = '0' WHERE GuildId = '"..player:GetGuildId().."'"0)
                
    player:SendBroadcastMessage("You succesfully sold zone "..AreaId..".")
                
    player:DealGoldMerit(SELLPRICE)
            else
                
    player:SendBroadcastMessage("This zone is not yours!")
            
    end
            
    return 0
        end
        
    if (msg == AddTele) and (player:IsInGuild() == true) and (player:GetGuildLeader() == player:GetName()) then
            local AreaId 
    tostring(player:GetAreaId())
            if (
    OwnsArea(playerAreaId) == 1) or (OwnsArea(playerAreaId) == 2) or (OwnsArea(playerAreaId) == 3) or (OwnsArea(playerAreaId) == 4) or (OwnsArea(playerAreaId) == 5then
                CharDBQuery
    ("UPDATE guild SET Map = '"..player:GetMapId().."' WHERE GuildId = '"..player:GetGuildId().."'"0)
                
    CharDBQuery("UPDATE guild SET PosX = '"..player:GetX().."' WHERE GuildId = '"..player:GetGuildId().."'"0)
                
    CharDBQuery("UPDATE guild SET PosY = '"..player:GetY().."' WHERE GuildId = '"..player:GetGuildId().."'"0)
                
    CharDBQuery("UPDATE guild SET PosZ = '"..player:GetZ().."' WHERE GuildId = '"..player:GetGuildId().."'"0)
                
    player:SendBroadcastMessage("You and your guildmembers can now teleport here by using "..TeleMsg..".")
            else
                
    player:SendBroadcastMessage("This zone is not yours!")
            
    end
            
    return 0
        end
        
    if (msg == TeleMsgthen
            
    if (player:IsInGuild() == truethen
                
    if (CharDBQuery("SELECT PosX FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) ~= "0"then
                    player
    :Teleport(CharDBQuery("SELECT Map FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0), CharDBQuery("SELECT PosX FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0), CharDBQuery("SELECT PosY FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0), CharDBQuery("SELECT PosZ FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0))
                else
                    
    player:SendBroadcastMessage("Your guild does not have a zone or the guildmaster did not set a teleport position.")
                
    end
            
    else
                
    player:SendBroadcastMessage("You have to be in a guild in order to use this command.")
            
    end
            
    return 0
        end    
        
    if (msg == ZoneInfothen
            
    if (RestrictedArea(player) == false) or (player:GetInstanceID() ~= nilthen
                player
    :SendBroadcastMessage("AreaId: "..player:GetAreaId()..".")
                
    player:SendBroadcastMessage("Status: Cannot be bought.")
            elseif (
    AreaCheck(player) == falsethen    
                player
    :SendBroadcastMessage("AreaId: "..player:GetAreaId()..".")
                
    player:SendBroadcastMessage("Status: Currently not for sale.")
            else
                
    player:SendBroadcastMessage("AreaId: "..player:GetAreaId()..".")
                
    player:SendBroadcastMessage("Status: For sale.")
            
    end
            
    return 0
        end
        
    if (msg == OwnedZonesthen
            
    if (CharDBQuery("SELECT Zone1 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) ~= "0") or (CharDBQuery("SELECT Zone2 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) ~= "0") or (CharDBQuery("SELECT Zone3 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) ~= "0") or (CharDBQuery("SELECT Zone4 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) ~= "0") or (CharDBQuery("SELECT Zone5 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) ~= "0"then
                player
    :SendBroadcastMessage("Area's your guild currently owns are:")
                if (
    CharDBQuery("SELECT Zone1 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) ~= "0"then
                    player
    :SendBroadcastMessage(""..CharDBQuery("SELECT Zone1 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0).."")
                
    end
                
    if (CharDBQuery("SELECT Zone2 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) ~= "0"then
                    player
    :SendBroadcastMessage(""..CharDBQuery("SELECT Zone2 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0).."")
                
    end
                
    if (CharDBQuery("SELECT Zone3 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) ~= "0"then
                    player
    :SendBroadcastMessage(""..CharDBQuery("SELECT Zone3 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0).."")
                
    end
                
    if (CharDBQuery("SELECT Zone4 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) ~= "0"then
                    player
    :SendBroadcastMessage(""..CharDBQuery("SELECT Zone4 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0).."")
                
    end
                
    if (CharDBQuery("SELECT Zone5 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) ~= "0"then
                    player
    :SendBroadcastMessage(""..CharDBQuery("SELECT Zone5 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0).."")
                
    end
            
    else
                
    player:SendBroadcastMessage("Your guild does not own any zones.")
            
    end    
            
    return 0
        end    
        
    if (msg == Buffthen
            local AreaId 
    tostring(player:GetAreaId())
            if (
    OwnsArea(playerAreaId) == 1) or (OwnsArea(playerAreaId) == 2) or (OwnsArea(playerAreaId) == 3) or (OwnsArea(playerAreaId) == 4) or (OwnsArea(playerAreaId) == 5then
                player
    :CastSpell(56525) -- Blessing of Kings
                player
    :CastSpell(48162) -- Prayer of Fortitude
                player
    :CastSpell(48074) -- Prayer of Spirit
                player
    :CastSpell(48470) -- Gift of the Wild
                player
    :CastSpell(53307) -- Thorns
            
    else
                
    player:SendBroadcastMessage("You can only use this in the areas your guild owns.")
            
    end
            
    return 0
        end
        
    if (msg == Commandsthen
            
    if (player:IsInGuild() == true) and (player:GetGuildLeader() == player:GetName()) then
                player
    :SendBroadcastMessage("Commands available for you:")
                
    player:SendBroadcastMessage(""..BuyZone.." - To buy a zone.")
                
    player:SendBroadcastMessage(""..SellZone.." AreaId - To sell a zone.")
                
    player:SendBroadcastMessage(""..AddTele.." - To add a teleport you and your guild members can use.")
                
    player:SendBroadcastMessage(""..TeleMsg.." - Teleport to the place your guildmaster set.")
                
    player:SendBroadcastMessage(""..ZoneInfo.." - Displays the status + area id of the area you are at.")
                
    player:SendBroadcastMessage(""..OwnedZones.." - Displays the zones your guild currently owns.")
                
    player:SendBroadcastMessage(""..Buff.." - Buffs you while in an area your guild owns.")
            elseif (
    player:IsInGuild() == truethen
                player
    :SendBroadcastMessage("Commands available for you:")
                
    player:SendBroadcastMessage(""..TeleMsg.." - Teleport to the place your guildmaster set.")
                
    player:SendBroadcastMessage(""..ZoneInfo.." - Displays the status + area id of the area you are at.")
                
    player:SendBroadcastMessage(""..OwnedZones.." - Displays the zones your guild currently owns.")
                
    player:SendBroadcastMessage(""..Buff.." - Buffs you while in an area your guild owns.")
            
    end
            
    return 0
        end        
    end    
                    
    function GuildAreaCheck(player)
        if (
    CharDBQuery("SELECT Zone5 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) == falsethen
            CharDBQuery
    ("INSERT INTO guild(GuildId, Zone1, Zone2, Zone3, Zone4, Zone5, Map, PosX, PosY, PosZ) VALUES ('"..player:GetGuildId().."', '0', '0', '0', '0', '0', '0', '0', '0', '0')"0)
            return 
    true
        
    elseif (CharDBQuery("SELECT Zone1 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) == "0") or (CharDBQuery("SELECT Zone2 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) == "0") or (CharDBQuery("SELECT Zone3 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) == "0") or (CharDBQuery("SELECT Zone4 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) == "0") or (CharDBQuery("SELECT Zone5 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) == "0"then
            
    return true
        
    else
            return 
    false
        end
    end    

    function AreaCheck(player
        if (
    CharDBQuery("SELECT Zone1 FROM guild WHERE Zone1 = '"..player:GetAreaId().."'"0) == false) and (CharDBQuery("SELECT Zone2 FROM guild WHERE Zone2 = '"..player:GetAreaId().."'"0) == false) and (CharDBQuery("SELECT Zone3 FROM guild WHERE Zone3 = '"..player:GetAreaId().."'"0) == false) and (CharDBQuery("SELECT Zone4 FROM guild WHERE Zone4 = '"..player:GetAreaId().."'"0) == false) and (CharDBQuery("SELECT Zone5 FROM guild WHERE Zone5 = '"..player:GetAreaId().."'"0) == falsethen
            
    return true
        
    else
            return 
    false
        end
    end    

    function AddArea(player
        if (
    CharDBQuery("SELECT Zone1 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) == "0"then
            CharDBQuery
    ("UPDATE guild SET Zone1 = '"..player:GetAreaId().."' WHERE GuildId = '"..player:GetGuildId().."'"0)
        elseif (
    CharDBQuery("SELECT Zone2 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) == "0"then    
            CharDBQuery
    ("UPDATE guild SET Zone2 = '"..player:GetAreaId().."' WHERE GuildId = '"..player:GetGuildId().."'"0)
        elseif (
    CharDBQuery("SELECT Zone3 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) == "0"then    
            CharDBQuery
    ("UPDATE guild SET Zone3 = '"..player:GetAreaId().."' WHERE GuildId = '"..player:GetGuildId().."'"0)
        elseif (
    CharDBQuery("SELECT Zone4 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) == "0"then    
            CharDBQuery
    ("UPDATE guild SET Zone4 = '"..player:GetAreaId().."' WHERE GuildId = '"..player:GetGuildId().."'"0)
        elseif (
    CharDBQuery("SELECT Zone5 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) == "0"then    
            CharDBQuery
    ("UPDATE guild SET Zone5 = '"..player:GetAreaId().."' WHERE GuildId = '"..player:GetGuildId().."'"0)
        
    end
    end    

    function RestrictedArea(player
        for 
    kv in pairs(NotBuyableAreas) do
            if (
    player:GetAreaId() ~= vthen
                
    return true
            
    else
                return 
    false
            end
        end
    end    
                
    function OwnsArea(playerAreaId)
        if (
    CharDBQuery("SELECT Zone1 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) == AreaIdthen
            
    return 1
        
    elseif (CharDBQuery("SELECT Zone2 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) == AreaIdthen
            
    return 2
        
    elseif (CharDBQuery("SELECT Zone3 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) == AreaIdthen
            
    return 3
        
    elseif (CharDBQuery("SELECT Zone4 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) == AreaIdthen
            
    return 4
        
    elseif (CharDBQuery("SELECT Zone5 FROM guild WHERE GuildId = '"..player:GetGuildId().."'"0) == AreaIdthen
            
    return 5
        
    else
            return 
    false
        end
    end    

    RegisterServerHook
    (16"GUILD.ZoneCommands"



    Credits:

    Grandelf



    › See More: [Lua] Guild zone system
    Last edited by Dr. Fallen; 15-03-10 at 03:23 PM.





  2. Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread

  3. #2
    Scout
    Grandelf's Avatar
    Join Date
    Nov 2009
    Posts
    13
    Post Thanks / Like
    Rep Power
    15
    Reputation
    27
    Would be nice if you gave credits to me at least.. because I see you remove the "Made by Grandelf" part of the script. Lua | --[[ Guild zone system. - Anonymous - 8y0xhP49 - Pastebin.com.

  4. #3
    Banned

    Join Date
    Jan 2010
    Location
    Baltimore,Maryland
    Posts
    260
    Post Thanks / Like
    Rep Power
    0
    Reputation
    87
    Quote Originally Posted by grandelf View Post
    would be nice if you gave credits to me at least.. Because i see you remove the "made by grandelf" part of the script. lua | --[[ guild zone system. - anonymous - 8y0xhp49 - pastebin.com.

    oh shit the doctor is a fake now

  5. #4
    Sergeant
    Dr. Fallen's Avatar
    Join Date
    Mar 2010
    Location
    Turkey
    Posts
    74
    Post Thanks / Like
    Rep Power
    15
    Reputation
    64
    Quote Originally Posted by Grandelf View Post
    Would be nice if you gave credits to me at least.. because I see you remove the "Made by Grandelf" part of the script. Lua | --[[ Guild zone system. - Anonymous - 8y0xhP49 - Pastebin.com.
    like i told to MC something im not gonna make advertisement of ppl which is not registered on this forum

    anyway welcome aboard

    credits added

    and 1 more thing its bugged for me

    when i try to buy a zone it says

    Your guild already owns the maximum of allowed zones
    Last edited by Dr. Fallen; 15-03-10 at 03:25 PM.



  6. #5
    Elite Member
    Dimman's Avatar
    Join Date
    Apr 2009
    Posts
    1,091
    Post Thanks / Like
    Rep Power
    21
    Reputation
    319
    Quote Originally Posted by Grandelf View Post
    Would be nice if you gave credits to me at least.. because I see you remove the "Made by Grandelf" part of the script. Lua | --[[ Guild zone system. - Anonymous - 8y0xhP49 - Pastebin.com.
    Jerry is a jerk. Can't even get hes own name lol pff.. fail community
    Last edited by Dimman; 15-03-10 at 03:38 PM.
    No touching please.

  7. #6
    Scout
    Grandelf's Avatar
    Join Date
    Nov 2009
    Posts
    13
    Post Thanks / Like
    Rep Power
    15
    Reputation
    27
    Quote Originally Posted by «Dimman» View Post
    ... You are super mod on the Top 1 leech site so gtfo :#

    & Jerry is a jerk. Can't even get hes own name lol pff.. fail community
    You should check that another time and then tell me what you think of what you just said =].
    Last edited by Dimman; 15-03-10 at 03:30 PM.

  8. #7
    Sergeant
    Dr. Fallen's Avatar
    Join Date
    Mar 2010
    Location
    Turkey
    Posts
    74
    Post Thanks / Like
    Rep Power
    15
    Reputation
    64
    please

    /flame off



  9. #8
    Elite Member
    Dimman's Avatar
    Join Date
    Apr 2009
    Posts
    1,091
    Post Thanks / Like
    Rep Power
    21
    Reputation
    319
    Quote Originally Posted by Grandelf View Post
    You should check that another time and then tell me what you think of what you just said =].
    Why do you even waste time being on that noob site ?
    No touching please.

  10. #9
    Scout
    Grandelf's Avatar
    Join Date
    Nov 2009
    Posts
    13
    Post Thanks / Like
    Rep Power
    15
    Reputation
    27
    Wasn't flaming =]. I never flame actually, I just asked him kindly to check that again. Also MysteriousSoul asked me to post Lua scripts here and then you tell me to GTFO? Besides, I am not just on there, I spend time at all forums =].

  11. #10
    Elite Member
    Dimman's Avatar
    Join Date
    Apr 2009
    Posts
    1,091
    Post Thanks / Like
    Rep Power
    21
    Reputation
    319

    Register to remove this ad
    Quote Originally Posted by Grandelf View Post
    Wasn't flaming =]. I never flame actually, I just asked him kindly to check that again. Also MysteriousSoul asked me to post Lua scripts here and then you tell me to GTFO? Besides, I am not just on there, I spend time at all forums =].
    Sorry for giving you all the shit. But i hate that community ... 99% of all posts there = leeched... useless community imo .

    And how do you stay unbanned from mmown ?
    No touching please.

 

 
Page 1 of 2 12 LastLast

Visitors found this page by searching for:

luahyparc area

SEO Blog

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -5. The time now is 06:06 AM.
Powered by vBulletin® Copyright ©2000-2024, Jelsoft Enterprises Ltd.
See More links by ForumSetup.net. Feedback Buttons provided by Advanced Post Thanks / Like (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
vBulletin Licensed to: MMOPro.org