Jump to content

[Help]Ambulance spawn


Recommended Posts

Posted

how to make this cods together ( if player spawn car from 1st marker and whan't to spawn car from 2nd the dirst car destrooyed?)

 ambulancee= createMarker(2000.921875, -1412.892578125, 16, "cylinder", 2.0, 255, 255,255, 255) 
setElementVisibleTo(ambulance, root, false) 
  
local jobVehicles = {} 
  
addEventHandler("onMarkerHit", ambulancee, 
    function(hitElement)  
        if (getElementType(hitElement) ~= "player") then return end 
        local x, y, z = getElementPosition(hitElement) -- Gets the player's position and get his x,y,z coordinates 
        local team = getPlayerTeam(hitElement) -- Gets the player's current team 
        if(isPedInVehicle(hitElement)) then return end 
        if (jobVehicles[hitElement] and isElement(jobVehicles[hitElement])) then destroyElement(jobVehicles[hitElement]) end 
        if (team and getTeamName(team) == "Medic") then 
                                setElementVisibleTo(ambulance, root, true)    
            jobVehicles[hitElement] = createVehicle (416, x, y, z, 0, 0, 180) -- creates a infernus at the player coordenates 
            setTimer(warpPedIntoVehicle, 250, 1, hitElement, jobVehicles[hitElement]) -- warps the player inside the vehicle 
        end 
end 
)  
  
  

 ambulancee= createMarker(1178.0423583984, -1338.7836914063, 13, "cylinder", 2.0, 255, 255,255, 255) -- Creates a marker in the center of the map 
setElementVisibleTo(ambulance, root, false) 
  
local jobVehicles = {} 
  
addEventHandler("onMarkerHit", ambulancee, 
    function(hitElement)  
        if (getElementType(hitElement) ~= "player") then return end 
        local x, y, z = getElementPosition(hitElement) -- Gets the player's position and get his x,y,z coordinates 
        local team = getPlayerTeam(hitElement) -- Gets the player's current team 
        if(isPedInVehicle(hitElement)) then return end 
        if (jobVehicles[hitElement] and isElement(jobVehicles[hitElement])) then destroyElement(jobVehicles[hitElement]) end 
        if (team and getTeamName(team) == "Medic") then 
                                setElementVisibleTo(ambulance, root, true)    
            jobVehicles[hitElement] = createVehicle (416, x, y, z, 0, 0, -90) -- creates a infernus at the player coordenates 
            setTimer(warpPedIntoVehicle, 250, 1, hitElement, jobVehicles[hitElement]) -- warps the player inside the vehicle 
        end 
end 
)  
  

Posted (edited)

I don't understand you. Your english is more complicated than dog language..

Second marker shouldn't have same variable as first marker.

Edited by Guest

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