Jump to content

Help event script


Sasu

Recommended Posts

function evento(source) 
if (isElement(theMarker)) then 
destroyElement(theMarker) 
local nombre2 = getPlayerName(source) 
outputChatBox("#FF0000[AVISO]#00FF00Eventos removidos por #0000FF"..nombre2.."#00FF00.", getRootElement(), 255, 255, 255, true) 
removeCommandHandler("eventwarp") 
else 
local x,y,z = getElementPosition(source) 
local theMarker = createMarker ( x, y, z, "checkpoint", 2, 255, 255, 255, 100 ) 
local nombre = getPlayerName(source) 
outputChatBox("#FF0000[AVISO]#00FF00Se ha creado un evento por #0000FF"..nombre..". #00FF00Usa #FF0000/eventwarp #00FF00para participar!", getRootElement(), 255, 255, 255, true) 
addCommandHandler("eventwarp", eventowarp) 
end 
end 
addCommandHandler("event", evento) 
  
function eventowarp(thePlayer) 
if isElement(theMarker) then 
setElementPosition( thePlayer, x, y, z) 
end 
end 

Its create the marker but when I executed the command "event" again its create another marker. Also "eventwarp" It doesnt work. Can you help me?

Link to comment

Try

function evento(source) 
    if (isElement(theMarker)) then 
        destroyElement(theMarker) 
        local nombre2 = getPlayerName(source) 
        outputChatBox("#FF0000[AVISO]#00FF00Eventos removidos por #0000FF"..nombre2.."#00FF00.", getRootElement(), 255, 255, 255, true) 
        removeCommandHandler("eventwarp") 
    else 
        local x,y,z = getElementPosition(source) 
        theMarker = createMarker ( x, y, z, "checkpoint", 2, 255, 255, 255, 100 ) 
        local nombre = getPlayerName(source) 
        outputChatBox("#FF0000[AVISO]#00FF00Se ha creado un evento por #0000FF"..nombre..". #00FF00Usa #FF0000/eventwarp #00FF00para participar!", getRootElement(), 255, 255, 255, true) 
        addCommandHandler("eventwarp", eventowarp) 
    end 
end 
addCommandHandler("event", evento) 
  
function eventowarp(thePlayer) 
    if isElement(theMarker) then 
        local x, y, z = getElementPosition(theMarker) 
        setElementPosition(thePlayer, x, y, z) 
    end 
end 

Link to comment
Try
function evento(source) 
    if (isElement(theMarker)) then 
        destroyElement(theMarker) 
        local nombre2 = getPlayerName(source) 
        outputChatBox("#FF0000[AVISO]#00FF00Eventos removidos por #0000FF"..nombre2.."#00FF00.", getRootElement(), 255, 255, 255, true) 
        removeCommandHandler("eventwarp") 
    else 
        local x,y,z = getElementPosition(source) 
        theMarker = createMarker ( x, y, z, "checkpoint", 2, 255, 255, 255, 100 ) 
        local nombre = getPlayerName(source) 
        outputChatBox("#FF0000[AVISO]#00FF00Se ha creado un evento por #0000FF"..nombre..". #00FF00Usa #FF0000/eventwarp #00FF00para participar!", getRootElement(), 255, 255, 255, true) 
        addCommandHandler("eventwarp", eventowarp) 
    end 
end 
addCommandHandler("event", evento) 
  
function eventowarp(thePlayer) 
    if isElement(theMarker) then 
        local x, y, z = getElementPosition(theMarker) 
        setElementPosition(thePlayer, x, y, z) 
    end 
end 

Perfect. Thank you very much.

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...