[Lua] Event System menu

User Tag List

Results 1 to 6 of 6
  1. #1
    Dr. Livingstone's Avatar Member
    Reputation
    113
    Join Date
    Mar 2008
    Posts
    290
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Lua] Event System

    Event System
    By Dr. Livingstone

    The event system is a system that more easily allows for GM's to run events for the players. It alleviates the troubles of having to have to summon players in, and then port them out. Using simple chat commands you can perform all the necessary tasks except giving out the reward, and players will be able to join, leave, and unstick themselves from the event. Hope you enjoy!

    Code:
    --GM Config --
    local SERVERNAME = DrLivingstone -- Change to your server name
    
    -- Player Config --
    local AllowStuck = true --[True/False] If true, then the player will be to use the #stuck command to revive them and transport them to their mall
    
    local HordeMall = X, Y, Z -- Set to the location of your Horde mall
    local AllianceMall = X, Y, Z -- Set to the location of your Alliance mall
    
    -- Chat Commands --
    local StartMessage = "#start"
    local EndMessage = "#end"
    local RemindMessage = "#remind"
    local JoinMessage = "#join"
    local LeaveMessage = "#leave"
    local StuckMessage = "#stuck"
    
    -- Script --
    function GM_OnChat(event, pPlayer, message, type, language)
    	local LCM = message:lower()
    	if (LCM == StartMessage) and (pPlayer:IsGM() == true) then
    		local NAME == pPlayer:GetName()
    		pPlayer:SendChatMessage(41, 0, "..NAME.. has started an event. To participate simply '#join'! Hope to see you around.")
    		local X = pPlayer:GetX()
    		local Y = pPlayer:GetY()
    		local Z = pPlayer:GetZ()
    		local MAPID = pPlayer:GetMapID()
    		local EventStarted == true
    	elseif (LCM == EndMessage) and (pPlayer:IsGM() == true) then
    		pPlayer:SendChatMessage(41, 0, "..NAME.. has ended the current event. Thank you for participating and thank you for playing at ..SERVERNAME..")
    	end
    	elseif (LCM == RemindMessage) and (pPlayer:IsGM() == true) then
    		pPlayer:SendChatMessage(41, 0, "Remember! There is an on-going event right now! Simply type '#join' to join!")
    	end
    	
    function Player_OnChat(event, pPlayer, message, type, language)
    	if (EventStarted == true) then
    		if (LCM == JoinMessage) then
    			pPlayer:SendChatMessage(13, 0, "Thank you for joining the event!")
    			pPlayer:Teleport(MAPID, X, Y, Z)
    		elseif (LCM == LeaveMessage) then
    			pPlayer:SendChatMessage(13, 0, "Thank you for participating in the event! We hope you had fun.")
    				if (pPlayer:GetFaction() == 0) then
    					pPlayer:Teleport(AllianceMall)
    				elseif (pPlayer:GetFaction() == 1) then
    					pPlayer:Teleport(HordeMall)
    				end
    		elseif (LCM == StuckMessage) then
    			pPlayer:SendChatMessage(13, 0, "We are teleporting you back to the start of the event. We apologize for your becoming stuck.")
    			pPlayer:Teleport(MAPID, X, Y, Z)
    		end
    	else
    		pPlayer:SendChatMessage(13, 0, "There is no event currently active")
    	end
    end
    
    RegisterServerHook(16, "Player_OnChat")
    RegisterServerHook(16, "GM_OnChat")
    Also, if you are good with lua. I'm looking for a way to have it set that an event is active if a GM starts the event. Then check if its active before players use the commands. And then set it as inactive when the GM ends the event. If you know how to do this help me out!
    Last edited by Dr. Livingstone; 03-26-2010 at 02:20 PM.

    [Lua] Event System
  2. #2
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,554
    Thanks G/R
    151/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I'm looking for a way to have it set that an event is active if a GM starts the event. Then check if its active before players use the commands.
    local GM = 0

    at top

    function on chat
    if message == #EventOn
    if pPlayer:IsGm() then
    GM = 1
    end
    end

    Repeat the above function with #EventOff.

    Then when a player sends a message:

    if GM == 1 then
    do stuff
    else
    the event is not active
    end

    Good luck.

    Edit: Did you test your script? Your variables are defined with 2 ='s instead of 1...
    Last edited by stoneharry; 03-26-2010 at 01:49 PM.

  3. #3
    Link_S's Avatar Member
    Reputation
    125
    Join Date
    Dec 2008
    Posts
    293
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Dr. Livingstone View Post
    [CODE]--GM Config --
    local SERVERNAME == DrLivingstone -- Change to your server name

    -- Player Config --
    local AllowStuck == true --[True/False] If true, then the player will be to use the #stuck command to revive them and transport them to their mall

    local HordeMall == X, Y, Z -- Set to the location of your Horde mall
    local AllianceMall == X, Y, Z -- Set to the location of your Alliance mall

    -- Chat Commands --
    local StartMessage == "#start"
    local EndMessage == "#end"
    local RemindMessage == "#remind"
    local JoinMessage == "#join"
    local LeaveMessage == "#leave"
    local StuckMessage == "#stuck"
    When you initialize the variables. You don't usually use a boolean operator such as '==', you use a simple '='. I think this is a typo error by you, cause you initialize them in the function script using a single '='.
    Code:
    
    
    Code:
    local SERVERNAME = DrLivingstone -- Change to your server name
    
    -- Player Config --
    local AllowStuck = true --[True/False] If true, then the player will be  to use the #stuck command to revive them and transport them to their  mall
    
    local HordeMall = X, Y, Z -- Set to the location of your Horde mall
    local AllianceMall = X, Y, Z -- Set to the location of your Alliance  mall
    
    -- Chat Commands --
    local StartMessage = "#start"
    local EndMessage = "#end"
    local RemindMessage = "#remind"
    local JoinMessage = "#join"
    local LeaveMessage = "#leave"
    local StuckMessage = "#stuck"


    I bet that'd work better, although I'm no master in Lua syntax. I might be wrong.
    Why do I need a signature?

  4. #4
    Dr. Livingstone's Avatar Member
    Reputation
    113
    Join Date
    Mar 2008
    Posts
    290
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No your right Link_S >.< Just got working quick and I guess thats what happens. And to Stoneharry thanks. I'll include that in the next version. I tested it and then made some quick changes. Thats when I made the typos. Thanks for the help.

  5. #5
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Really nice script Good use of Lua here. Quite well done too. Might wanna change:

    Code:
    				if (pPlayer:GetFaction() == 0) then
    					pPlayer:Teleport(AllyMal)
    To:

    Code:
    				if (pPlayer:GetFaction() == 0) then
    					pPlayer:Teleport(AllianceMall)
    Or else they will get errors.




  6. #6
    Dr. Livingstone's Avatar Member
    Reputation
    113
    Join Date
    Mar 2008
    Posts
    290
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow. All those little changes are killing me right now. >.< Thanks for the help.

Similar Threads

  1. [Release] GM Event System
    By CoolManBob in forum WoW EMU General Releases
    Replies: 38
    Last Post: 06-02-2009, 11:37 PM
  2. [Contest Winner][AzolexX] Zombie LUA Event - Blizzlike as Possible
    By Hellgawd in forum WoW EMU General Releases
    Replies: 36
    Last Post: 02-26-2009, 07:36 AM
  3. [Question] Quest Trigger > Lua Event
    By Zudrik in forum WoW EMU Questions & Requests
    Replies: 7
    Last Post: 02-06-2009, 10:59 AM
  4. [Release] Temple of the Lunar (not just a boss fight) [Lua++][Event]
    By stoneharry in forum WoW EMU General Releases
    Replies: 16
    Last Post: 10-27-2008, 10:08 AM
  5. [Release] Portal Lua Event
    By Spartansp in forum World of Warcraft Emulator Servers
    Replies: 28
    Last Post: 02-04-2008, 09:46 AM
All times are GMT -5. The time now is 06:58 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search