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!