Lautaro12 Posted September 21, 2017 Share Posted September 21, 2017 Hola Lo que quiero es agregarle un limite de players para el /eventwarp Por ejemplo creo el evento y solo habra un cupo para 10 players Solo tengo esto function evento(source, cmd, ...) for _, group in ipairs ({"Admin"}) do local playerAccount = getPlayerAccount(source) if (not playerAccount) then return end local accountName = getAccountName(playerAccount) if isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( group ) ) then if (isElement(theMarker)) then destroyElement(theMarker) local nombre2 = getPlayerName(source) outputChatBox("[AVISO] Eventos removidos por "..nombre2..".", getRootElement(), 255, 255, 255, true) removeCommandHandler("eventwarp") else local x,y,z = getElementPosition(source) local interior = getElementInterior(source) theMarker = createMarker ( x, y, z, "checkpoint", 2, 255, 255, 255, 100 ) setElementInterior(theMarker, interior, x, y, z) local nombre = getPlayerName(source) local message = table.concat ( { ... }, " " ) outputChatBox("[AVISO] Se ha creado un evento por "..nombre..". Usa /eventwarp para participar!", getRootElement(), 255, 255, 255, true) if ... then outputChatBox("El evento creado es de: "..message, getRootElement(), 255, 255, 255, true) end addCommandHandler("eventwarp", eventowarp) end end end end addCommandHandler("event", evento) function eventowarp(thePlayer) if isElement(theMarker) then local x, y, z = getElementPosition(theMarker) local interior = getElementInterior(theMarker) fadeCamera ( thePlayer, false, 1.0, 0, 0, 0 ) setTimer(fadeCamera, 2000, 1, thePlayer, true, 1.0) setTimer(setElementPosition, 2000, 1, thePlayer, x, y, z) setTimer(setElementInterior, 2000, 1, thePlayer, interior, x, y, z) end end Link to comment
alex17" Posted September 21, 2017 Share Posted September 21, 2017 function evento(source, cmd, ...) for _, group in ipairs ({"Admin"}) do local playerAccount = getPlayerAccount(source) if (not playerAccount) then return end local accountName = getAccountName(playerAccount) if isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( group ) ) then if (isElement(theMarker)) then destroyElement(theMarker) local nombre2 = getPlayerName(source) outputChatBox("[AVISO] Eventos removidos por "..nombre2..".", getRootElement(), 255, 255, 255, true) removeCommandHandler("eventwarp") else local x,y,z = getElementPosition(source) local interior = getElementInterior(source) players = 0 theMarker = createMarker ( x, y, z, "checkpoint", 2, 255, 255, 255, 100 ) setElementInterior(theMarker, interior, x, y, z) local nombre = getPlayerName(source) local message = table.concat ( { ... }, " " ) outputChatBox("[AVISO] Se ha creado un evento por "..nombre..". Usa /eventwarp para participar!", getRootElement(), 255, 255, 255, true) if ... then outputChatBox("El evento creado es de: "..message, getRootElement(), 255, 255, 255, true) end addCommandHandler("eventwarp", eventowarp) end end end end addCommandHandler("event", evento) function eventowarp(thePlayer) if isElement(theMarker) then if players >= 10 then return outputChatBox("Evento Lleno", thePlayer, 255, 0, 0, true) end local x, y, z = getElementPosition(theMarker) local interior = getElementInterior(theMarker) players = players + 1 fadeCamera ( thePlayer, false, 1.0, 0, 0, 0 ) setTimer(fadeCamera, 2000, 1, thePlayer, true, 1.0) setTimer(setElementPosition, 2000, 1, thePlayer, x, y, z) setTimer(setElementInterior, 2000, 1, thePlayer, interior, x, y, z) end end Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now