BlackSoul Posted October 22, 2017 Share Posted October 22, 2017 este es un scrip que cree para k genere una torre pero el problema es que cuando genero la segunda torre la primera no desaparese, que tendria que hacer para que el primero desaparesaca ?? miren esto es lo que llevo script function CreateVisor ( thePlayer, commandName ) if ( thePlayer ) then local x, y, z = getElementPosition ( thePlayer ) -- get the player's position -- create a Object next to the player: local theObject = createObject ( 3279, x + 5, y + 0, z + -1, 0, 0, 0 ) if ( theObject ) then -- check if the Obeject was created successfully outputConsole ( "Visor puesto", thePlayer ) else outputConsole ( "Visor no puesto", thePlayer ) end end end addCommandHandler ( "visor", CreateVisor ) Link to comment
alex17" Posted October 22, 2017 Share Posted October 22, 2017 (edited) torres = {} function CreateVisor ( thePlayer, commandName ) if ( thePlayer ) then local x, y, z = getElementPosition ( thePlayer ) if torres[thePlayer] then destroyElement(torres[thePlayer]) torres[thePlayer] = nil end torres[thePlayer] theObject = createObject ( 3279, x + 5, y + 0, z + -1, 0, 0, 0 ) if ( torres[thePlayer] ) then outputConsole ( "Visor puesto", thePlayer ) else outputConsole ( "Visor no puesto", thePlayer ) end end end addCommandHandler ( "visor", CreateVisor ) Edited October 22, 2017 by alex17" 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