Jump to content

DestroyElement


toptional

Recommended Posts

Posted

Hi so I'm trying to destroy these 2 elements, a blip and a marker.

They are created here

DestinationBlip = createBlip ( 1514.71289, 1205.07666, 10.83374, 41, 2,255, 0, 0, 255, 0, 100000) 
DestinationMarker = createMarker ( 1514.71289, 1205.07666, 10, "cylinder",  2, 9, 233, 213, 105 ) 

And destroyed here

    destroyElement ( DestinationBlip ) 
    destroyElement ( DestinationMarker ) 

It destroys the Blip but not the marker?

Whats wrong.

Posted

Created here

function doubleClicked ( ) 
    local row, col = guiGridListGetSelectedItem ( source ) 
    if ( row and col and row ~= -1 and col ~= -1 ) then 
        local vehicleName = guiGridListGetItemText ( source, row, 1 ) 
        triggerServerEvent ( "spawnPlane", localPlayer, vehicleName ) 
        guiSetVisible ( Window, false ) 
        showCursor ( false ) 
        DestinationBlip = createBlip ( 1514.71289, 1205.07666, 10.83374, 41, 2,255, 0, 0, 255, 0, 100000) 
        DestinationMarker = createMarker ( 1514.71289, 1205.07666, 10, "cylinder",  2, 9, 233, 213, 105 ) 
        addEventHandler ( "onClientMarkerHit", DestinationMarker, gettoDestination ) - 
    end 
end 
  

It's Destroyed here

function SpawnDodo () 
    triggerServerEvent ( "spawnDodo", localPlayer ) 
    guiSetVisible(Window2, false) 
    showCursor(false) 
    destroyElement ( DestinationBlip ) 
    destroyElement ( DestinationMarker ) 
    PassengerMarker = createMarker ( 1514.71289, 1205.07666, 10, "cylinder",  2, 9, 233, 213, 105 ) 
    PasengerMarker = createMarker (1574.69788, 1503.02808, 10.8363, "checkpoint",5,9,233,213,105 ) 
end 
addEventHandler ( 'onClientGUIClick', Button2, SpawnDodo, false ) 

Posted
  
function SpawnDodo () 
    triggerServerEvent ( "spawnDodo", localPlayer ) 
    guiSetVisible(Window2, false) 
    showCursor(false) then  
    destroyElement ( DestinationBlip )  
    destroyElement ( DestinationMarker )   
    PassengerMarker = createMarker ( 1514.71289, 1205.07666, 10, "cylinder",  2, 9, 233, 213, 105 ) 
    PasengerMarker = createMarker (1574.69788, 1503.02808, 10.8363, "checkpoint",5,9,233,213,105 ) 
end 
addEventHandler ( 'onClientGUIClick', Button2, SpawnDodo, false ) 

I added a then after showCursor(false) Try it now

Posted
  
function SpawnDodo () 
    triggerServerEvent ( "spawnDodo", localPlayer ) 
    guiSetVisible(Window2, false) 
    showCursor(false) then  
    destroyElement ( DestinationBlip )  
    destroyElement ( DestinationMarker )   
    PassengerMarker = createMarker ( 1514.71289, 1205.07666, 10, "cylinder",  2, 9, 233, 213, 105 ) 
    PasengerMarker = createMarker (1574.69788, 1503.02808, 10.8363, "checkpoint",5,9,233,213,105 ) 
end 
addEventHandler ( 'onClientGUIClick', Button2, SpawnDodo, false ) 

I added a then after showCursor(false) Try it now

this is wrong

   showCursor(false) then 

Posted

Yes that is wrong, no idea how that would fix it

Got this error with that

WARNING: Loading script failed: Avia_Intro\client.lua:78: unexpected symbol near 'then'

Posted
Yes that is wrong, no idea how that would fix it

Got this error with that

WARNING: Loading script failed: Avia_Intro\client.lua:78: unexpected symbol near 'then'

you are creating again.

function SpawnDodo () 
    triggerServerEvent ( "spawnDodo", localPlayer ) 
    guiSetVisible(Window2, false) 
    showCursor(false) 
    destroyElement ( DestinationBlip ) 
    destroyElement ( DestinationMarker ) 
    PassengerMarker = createMarker ( 1514.71289, 1205.07666, 10, "cylinder",  2, 9, 233, 213, 105 ) 
    PasengerMarker = createMarker (1574.69788, 1503.02808, 10.8363, "checkpoint",5,9,233,213,105 ) 
end 
addEventHandler ( 'onClientGUIClick', Button2, SpawnDodo, false ) 

function SpawnDodo () 
    guiSetVisible(Window2, false) 
    showCursor(false) 
    destroyElement ( DestinationBlip ) 
    destroyElement ( DestinationMarker ) 
end 
addEventHandler ( 'onClientGUIClick', Button2, SpawnDodo, false ) 

ERROR? post your full code

Posted

Thanks that worked

but i got another error

  
function mainFunction() 
             outputChatBox ("Your passengers are being loaded please stand by.",getRootElement(), 255, 0, 0, false ) 
            toggleAllControls ( false ) 
            setElementFrozen ( player, true ) 
setTimer(function () 
                     outputChatBox ("Your passengers now loaded please make your way to the runway to depart.",getRootElement(), 255, 0, 0, false ) 
                    toggleAllControls ( true ) 
                    setElementFrozen ( player, true ) 
                    destroyElement ( PasengerMarker ) 
        end, 5000, 1 ) 
end 
  

the setElementFrozen does not work getting a bad argument :/

Posted

function mainFunction( player ) 
             outputChatBox ("Your passengers are being loaded please stand by.",getRootElement(), 255, 0, 0, false ) 
            toggleAllControls ( player , false ) 
            setElementFrozen ( player , true ) 
setTimer(function (player) 
                    outputChatBox ("Your passengers now loaded please make your way to the runway to depart.",getRootElement(), 255, 0, 0, false ) 
                    toggleAllControls ( player,true ) 
                    setElementFrozen ( player, true ) 
                    destroyElement ( PasengerMarker ) 
        end, 5000, 1,player ) 
end 
  
Posted
Thanks that worked

but i got another error

  
function mainFunction() 
             outputChatBox ("Your passengers are being loaded please stand by.",getRootElement(), 255, 0, 0, false ) 
            toggleAllControls ( false ) 
            setElementFrozen ( player, true ) 
setTimer(function () 
                     outputChatBox ("Your passengers now loaded please make your way to the runway to depart.",getRootElement(), 255, 0, 0, false ) 
                    toggleAllControls ( true ) 
                    setElementFrozen ( player, true ) 
                    destroyElement ( PasengerMarker ) 
        end, 5000, 1 ) 
end 
  

the setElementFrozen does not work getting a bad argument :/

If this is a server sided script you're aware that every player will get those messages? and oh, the player isn't passed onto the function. Also, all those markers/blips will be visible for every player.

If it's a client script which I guess then change player to localPlayer and remove the second argument of outputChatBox as there isn't any visibleTo argument when using outputChatBox client sided.

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