Jump to content

[Help] CreateVehicle


raynner

Recommended Posts

I need one more little help from you guys, good following my problem now and this made this simple script to when the player passing the mark he get a vehicle however if it already is with 1 will not be able to catch it is worth remembering that the car has to stay the dimension 110 really appreciate if someone help me '-'

SpawnveicleRcLr01 = createMarker(-2147, -738, 31, "cylinder", 1.5, 255, 0, 0, 153) 
setElementDimension (SpawnveicleRcLr01, 110) 
function SpawnRcLR01(thePlayer) 
      if (isPedInVehicle(thePlayer)) then 
         outputChatBox("#ffff00[ #ff0000LOS RED #ffff00] #ff0000Você Já Esta Dirigindo um Veiculo Tente Novamente Sem Veiculo em Posse.", thePlayer, 255, 255, 255, true) 
      else 
         local x, y, z = getElementPosition(thePlayer) 
         setElementDimension (VTR, 110) 
         VTR = createVehicle(503, x + 5, y, z) 
      end 
      warpPedIntoVehicle( thePlayer, VTR ) 
      outputChatBox("#ffff00[ #ff0000LOS RED #ffff00] #00ff00Você Obteve o Carro Do Evento com Sucesso, #ff0000Não Utilize Handling#ffff00.", thePlayer, 255, 255, 255, true) 
end 
addEventHandler( "onMarkerHit", SpawnveicleRcLr01, SpawnRcLR01 ) 

Link to comment

try this

addEventHandler('onMarkerHit',SpawnveicleRcLr01, function ( element ) 
    if ( not isPedInVehicle ( element ) ) then 
    local Pos = { getElementPosition ( element ) } 
    Vehicle = createVehicle ( 503 , Pos[1] +5,Pos[2],Pos[3] ) 
    setElementDimension ( Vehicle , 110 ) 
    warpPedIntoVehicle ( element , Vehicle )  
    outputChatBox("#ffff00[ #ff0000LOS RED #ffff00] #00ff00Você Obteve o Carro Do Evento com Sucesso, #ff0000Não Utilize Handling#ffff00.", element, 255, 255, 255, true) 
    else 
    outputChatBox("#ffff00[ #ff0000LOS RED #ffff00] #ff0000Você Já Esta Dirigindo um Veiculo Tente Novamente Sem Veiculo em Posse.", element, 255, 255, 255, true) 
            end 
    end      
) 
  
Link to comment
try this

addEventHandler('onMarkerHit',SpawnveicleRcLr01, function ( hitElement ) 
    if (isElement(hitElement)) and (getElementType (hitElement) == "player") then 
        if ( not isPedInVehicle ( hitElement ) ) then 
        local Pos = { getElementPosition ( hitElement ) } 
        Vehicle = createVehicle ( 503 , Pos[1] +5,Pos[2],Pos[3] ) 
        setElementDimension ( Vehicle , 110 ) 
        warpPedIntoVehicle ( hitElement , Vehicle ) 
        outputChatBox("#ffff00[ #ff0000LOS RED #ffff00] #00ff00Você Obteve o Carro Do Evento com Sucesso, #ff0000Não Utilize Handling#ffff00.", hitElement, 255, 255, 255, true) 
        else 
        outputChatBox("#ffff00[ #ff0000LOS RED #ffff00] #ff0000Você Já Esta Dirigindo um Veiculo Tente Novamente Sem Veiculo em Posse.", hitElement, 255, 255, 255, true) 
                 end 
        end 
    end     
) 
  

Thank you very mano help so much to warn you forgot to by if (isElement(hitElement)) and (getElementType (hitElement) == "player") then

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