Jump to content

Local Issue


toptional

Recommended Posts

I get no debug errors,

What im trying to do is it checks if the player has a vehicle and it outputs the chatbox someone it toggle's off all controls and freezes the vehicle then after 5 seconds everything is reversed thats not working though.

  
  
function SpawnDodo () 
    triggerServerEvent ( "spawnDodo", localPlayer ) 
    guiSetVisible(Window2, false) 
    showCursor(false) 
    destroyElement ( DestinationBlip ) 
    destroyElement ( DestinationMarker ) 
    PasengerMarker = createMarker (1574.69788, 1503.02808, 10.8363, "checkpoint",5,9,233,213,105 ) 
    addEventHandler ( "onClientMarkerHit", PasengerMarker, mainFunction ) 
end 
addEventHandler ( 'onClientGUIClick', Button2, SpawnDodo, false ) 
  
  
  
function mainFunction( player ) 
        if ( getPedOccupiedVehicle (player) ) then 
            outputChatBox ("Your passengers are being loaded please stand by.",255, 50, 0, false ) 
            toggleAllControls ( false ) 
            setElementFrozen ( player, true ) 
         
setTimer(function (player) 
                    outputChatBox ("Your passengers now loaded please make your way to the runway to depart.", 255, 50, 0, false ) 
                    toggleAllControls ( true ) 
                    setElementFrozen (player, false ) 
                    destroyElement ( PasengerMarker ) 
        end, 5000, 1,player ) 
end 
        end 
         

Edited by Guest
Link to comment

function mainFunction( player ) 
        if ( getPedOccupiedVehicle (player) ) then 
            outputChatBox ("Your passengers are being loaded please stand by.",player,255, 50, 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.",player,255, 50, 0, false ) 
                    toggleAllControls ( player,true ) 
                    setElementFrozen (player, false ) 
                    destroyElement ( PasengerMarker ) 
            end,5000,1,player) 
        end 
    end 
  
Link to comment

Hmm... try this :

function SpawnDodo () 
    PasengerMarker = createMarker (1574.69788, 1503.02808, 10.8363, "checkpoint",5,9,233,213,105 ) 
    addEventHandler ( "onClientMarkerHit", PasengerMarker, mainFunction ) 
    triggerServerEvent ( "spawnDodo", localPlayer ) 
    guiSetVisible(Window2, false) 
    showCursor(false) 
    destroyElement ( DestinationBlip ) 
    destroyElement ( DestinationMarker ) 
end 
addEventHandler ( 'onClientGUIClick', Button2, SpawnDodo, false ) 
  
  
  
function mainFunction( player ) 
          if ( player ~= localPlayer ) then return end  
        if  ( getPedOccupiedVehicle (player) )  then 
            outputChatBox ("Your passengers are being loaded please stand by.",255, 50, 0, false ) 
            toggleAllControls ( false ) 
            setElementFrozen ( player, true ) 
setTimer(function (player) 
                    outputChatBox ("Your passengers now loaded please make your way to the runway to depart.", 255, 50, 0, false ) 
                    toggleAllControls ( true ) 
                    setElementFrozen (player, false ) 
                    destroyElement ( PasengerMarker ) 
        end, 5000, 1,player ) 
end 
        end 
         
Link to comment

Thanks it works! But i have another issue

there is another part of the script where you go into a marker with this other vehicle and get warped into the dodo, but the other vehicle doesn't go away here is that part of the script

  
addEvent ( "spawnPlane", true ) 
addEventHandler ( "spawnPlane", root, 
    function ( vehicleName ) 
        local vehicleModel = getVehicleModelFromName ( vehicleName ) 
        if ( vehicleModel ) then 
          -- add this to get spawn the vehicle in your exact position of the maker local x, y, z = getElementPosition ( source ) 
            local vehicle = createVehicle ( vehicleModel, 1690.14868, 1453.82971, 10.76650, 0, 0, 0 ) 
            warpPedIntoVehicle ( source, vehicle ) 
            outputChatBox ("#1874CDMake your way to Las Venturas Airport to pick up your plane!", source,24,116,205, true) 
        end 
    end 
) 
  

Link to comment

You need to destroy the other vehicle:

addEvent ( "spawnPlane", true ) 
addEventHandler ( "spawnPlane", root, 
    function ( vehicleName, oldVehicle ) 
        local vehicleModel = getVehicleModelFromName ( vehicleName ) 
        if ( vehicleModel ) then 
          -- add this to get spawn the vehicle in your exact position of the maker local x, y, z = getElementPosition ( source ) 
            local vehicle = createVehicle ( vehicleModel, 1690.14868, 1453.82971, 10.76650, 0, 0, 0 ) 
            warpPedIntoVehicle ( source, vehicle ) 
            outputChatBox ("#1874CDMake your way to Las Venturas Airport to pick up your plane!", source,24,116,205, true) 
        end 
    end 
) 

You will also need to pass the oldVehicle element in the triggerServerEvent.

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