Jump to content

Vehicle Gui


Gtagasje

Recommended Posts

Posted

Hi, I made a vehicle gui which will give you a vehicle if you press the button. And it works, but now I wan't it to warp you inside also,. This is what I have:

Server:

  
  
function createLS () 
     
    local LS = createVehicle ( 596, 1557.03284, -1605.92700, 13 ) 
  
end 
addEvent("PoliceLS",true) 
  
addEventHandler("PoliceLS", root, createLS) 
  
function createLV () 
  
    local LV = createVehicle ( 598, 1557.03284, -1605.92700, 13 ) 
     
end 
addEvent("PoliceLV",true) 
  
addEventHandler("PoliceLV", root, createLV) 
  
function createSF () 
  
    local SF = createVehicle ( 597, 1557.03284, -1605.92700, 13 ) 
     
end 
addEvent("PoliceSF",true) 
  
addEventHandler("PoliceSF", root, createSF) 
  
function createRan () 
  
    local Ran = createVehicle ( 599, 1557.03284, -1605.92700, 13 ) and warpPedIntoVehicle ( Ran ) 
     
end 
addEvent("PoliceRan",true) 
  
addEventHandler("PoliceRan", root, createRan) 
  

I didn't add the client because I know warpPedIntoVehicle is serverside.

Posted

Why you added

local Ran = createVehicle ( 599, 1557.03284, -1605.92700, 13 ) and warpPedIntoVehicle ( Ran ) 

"AND" ?

Try to remove it.

Posted

why your code has so much space?

function createLS () 
    local LS = createVehicle ( 596, 1557.03284, -1605.92700, 13 ) 
    warpPedIntoVehicle (source,LS) 
end 
addEvent("PoliceLS",true) 
addEventHandler("PoliceLS", root, createLS) 
  
function createLV () 
    local LV = createVehicle ( 598, 1557.03284, -1605.92700, 13 ) 
    warpPedIntoVehicle (source,LV) 
end 
addEvent("PoliceLV",true) 
addEventHandler("PoliceLV", root, createLV) 
  
function createSF () 
    local SF = createVehicle ( 597, 1557.03284, -1605.92700, 13 ) 
    warpPedIntoVehicle (source,SF) 
end 
addEvent("PoliceSF",true) 
addEventHandler("PoliceSF", root, createSF) 
  
function createRan () 
    local Ran = createVehicle ( 599, 1557.03284, -1605.92700, 13 ) 
    warpPedIntoVehicle (source,Ran) 
end 
addEvent("PoliceRan",true) 
addEventHandler("PoliceRan", root, createRan) 
  

  • MTA Team
Posted

Gtagasje, don't use several events for the same thing. Make one event, and as an argument put the model id

(triggerServerEvent("SpawnPoliceCar", root, modelID)

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