Jump to content

[HELP]Spawn Car


Recommended Posts

function spawncar( thePlayer ) 
    destroyElement( vechical )  
    local x,y,z = getElementPosition( thePlayer ) 
    local vechical = createVehicle( 468,  x,  y,  z ) -- Change Here 
    warpPedIntoVehicle ( thePlayer, vechical )     
end 
addCommandHandler( "create", spawncar) 
  

that Script will allow players when they type /create , Sanchez will create and they will warp in it

if you need another Vehicle Change 468 to your Vehicle ID @ Change Here Comment

Vehicle IDs https://wiki.multitheftauto.com/wiki/Vehicle_IDs

wait Please I am making the Destroy

Link to comment

here is a code allow you to create any car with typing : /create carID , type any car ID you wish and it'll be created to you

vehicle = {}  
function spawncar( thePlayer ,_, model) 
    if isElement(vehicle[thePlayer]) then destroyElement(vehicle[thePlayer])return end 
    local pX, pY, pZ = getElementPosition(thePlayer) 
    vehicle[thePlayer] = createVehicle(tonumber(model),pX,pY,pZ)  
    if (isElement(vehicle[thePlayer])) then  
      warpPedIntoVehicle ( thePlayer, vehicle[thePlayer] )    
      outputChatBox("You successfully created " ..tostring(getVehicleName(vehicle[thePlayer])),thePlayer,255,255,155) 
    else  
      outputChatBox("There is an error please type a valid vehicle number",thePlayer,255,0,0)   
    end  
end 
addCommandHandler( "create", spawncar)  

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