TroyBoy Posted February 14, 2012 Share Posted February 14, 2012 how can i create vehicle that i choose like /createvehicle hydra\520 how can i do this for all the vehicles not only hydra in 1 command Link to comment
Castillo Posted February 14, 2012 Share Posted February 14, 2012 addCommandHandler("createvehicle", function (thePlayer, cmd, ...) for index, v in ipairs({ ... }) do vehicleModel = tonumber(v) if (not vehicleModel) then vehicleModel = getVehicleModelFromName(v) end end local x, y, z = getElementPosition(thePlayer) local vehicle = createVehicle(tonumber(vehicleModel), x, y, z) if (vehicle) then outputChatBox("The vehicle: ".. getVehicleName(vehicle) .." was created.",thePlayer,0,255,0) end end ) Link to comment
Kenix Posted February 14, 2012 Share Posted February 14, 2012 (edited) addCommandHandler( 'create_vehicle', function( player,_,id_name ) local x,y,z = getElementPosition( player ) local model = getVehicleModelFromName( id_name ) if not model then model = tonumber( id_name ) end if createVehicle( model,x+1,y,z ) then outputChatBox( 'Success created: '..tostring( getVehicleNameFromModel( model ) ) ) else outputChatBox( 'Vehicle not created: '..tostring( getVehicleNameFromModel( model ) ) ) end end ) /create_vehicle [id/name] Edited February 14, 2012 by Guest Link to comment
Castillo Posted February 14, 2012 Share Posted February 14, 2012 Kenix: That won't work, he want's a script that you can spawn it via the vehicle name too. E.g: /createvehicle Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now