Jump to content

event system


BonSay~^

Recommended Posts

If you meant a simple event warps system, here is it i just made:

local warpsON = false 
local eX, eY, eZ = 0, 0, 0 
local eDim = 336 
  
function startEvent(plr, cmd, ...) 
    setElementDimension(plr, eDim) 
    eX, eY, eZ = getElementPosition(plr) 
    local msg = table.concat({...}, " ") 
    outputChatBox("Event warps are now open, type /ewarp to get to the location.", root, 0, 200, 0) 
    if (msg) and (#msg >= 2) then outputChatBox("Event Message: "..msg, root, 0, 150, 0) end 
    warpsON = true 
end 
addCommandHandler("startevent", startEvent) 
  
function warpPlayers(plr) 
    if (not warpsON) then outputChatBox("There is no event in progress right now!", plr, 200, 0, 0) return end 
    spawnPlayer(plr, eX, eY, eZ) 
    setElementDimension(plr, eDim) 
    outputChatBox("Successfully joined Event!", plr, 0, 200, 0) 
end 
addCommandHandler("ewarp", warpPlayers) 
  
function stopEvent(plr) 
    if (not warpsON) then outputChatBox("There is no event in progress right now!", plr, 200, 0, 0) return end 
    warpsON = false 
    eX, eY, eZ = 0, 0, 0 
    local eventPlrs = getElementsInDimension("player", 336) 
    for k, v in pairs (eventPlrs) do 
        setElementDimension(v, 336) 
        outputChatBox("Event have been cancelled by "..plr, v, 200, 0, 0) 
    end 
    outputChatBox("Successfully stopped Event!", plr, 0, 200, 0) 
end 
addCommandHandler("stopevent", stopEvent) 
  
function getElementsInDimension(theType,dimension) 
    local elementsInDimension = { } 
      for key, value in ipairs(getElementsByType(theType)) do 
        if getElementDimension(value)==dimension then 
        table.insert(elementsInDimension,value) 
        end 
      end 
      return elementsInDimension 
end 

^Sever side code + i grabbed getElementsWithinDimension from wiki's useful functions.

If that didn't worked or you didn't asked something like that, you may tell me in details, i'll try to remake a basic one again.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...