Mikhail Posted October 3, 2018 Posted October 3, 2018 (edited) Hola, soy nuevo y buscando en la wiki puse este comand Spoiler function consoleCreateMarker ( thePlayer, commandName ) if ( thePlayer ) then local x, y, z = getElementPosition ( thePlayer ) -- get the player's position -- create a cylindrical marker next to the player: local theMarker = createMarker ( x, y, z - 1, "cylinder", 1.5, 255, 255, 0, 170 ) if ( theMarker ) then -- check if the marker was created successfully outputConsole ( "El marcador se ha creado correctamente", thePlayer ) else outputConsole ( "Failed to create marker", thePlayer ) end end end addCommandHandler ( "createma", consoleCreateMarker ) Pero como hago un comando para borrar este elemento? Edited October 3, 2018 by Mikhail
Mikhail Posted October 3, 2018 Author Posted October 3, 2018 (edited) hice esto pero no me funciona, me dice Spoiler function marker11 ( marker11 ) if isElementWithinMarker(thePlayer) then -- checking if player is in a marker destroyElement ( marker ) end end Bad argument @ 'isElementWithinMarker' [Expected element at argument 1, got nil] Edited October 3, 2018 by Mikhail
error403 ツ Posted October 19, 2018 Posted October 19, 2018 function ConsoleEliminarMarker ( thePlayer, commandName ) if ( thePlayer ) then if ( theMarker ) then -- check if the marker was created successfully destroyElement ( theMarker ) else outputConsole ( "Failed to delete marker", thePlayer ) end end end addCommandHandler ( "deletetema", ConsoleEliminarMarker )
Enargy, Posted October 23, 2018 Posted October 23, 2018 On 19/10/2018 at 19:19, MedicenMarcos said: function ConsoleEliminarMarker ( thePlayer, commandName ) if ( thePlayer ) then if ( theMarker ) then -- check if the marker was created successfully destroyElement ( theMarker ) else outputConsole ( "Failed to delete marker", thePlayer ) end end end addCommandHandler ( "deletetema", ConsoleEliminarMarker ) function ConsoleEliminarMarker ( thePlayer, commandName ) if isElement(theMarker) then destroyElement(theMarker) theMarker = nil else outputConsole( "Failed to delete marker", thePlayer ) end end addCommandHandler( "deletetema", ConsoleEliminarMarker ) Cuando creas un elemento y lo guardas en una variable asegúrate de limpiar esa variable para liberar memoria.
error403 ツ Posted October 24, 2018 Posted October 24, 2018 On 23/10/2018 at 14:05, Enargy, said: function ConsoleEliminarMarker ( thePlayer, commandName ) if isElement(theMarker) then destroyElement(theMarker) theMarker = nil else outputConsole( "Failed to delete marker", thePlayer ) end end addCommandHandler( "deletetema", ConsoleEliminarMarker ) Cuando creas un elemento y lo guardas en una variable asegúrate de limpiar esa variable para liberar memoria. Ok gracias por la sugerencia!
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