itHyperoX Posted July 25, 2017 Share Posted July 25, 2017 Hello. I made a very simple createVehicle command, i need help with, how can i add to this "blocked" vehicles ? I dont know what should i do, i have to add table with vehicle id-s and with names? Or how can i block some vehicle which is can not be spawned? local vehicleSlotID = 0 addCommandHandler("makeveh",function(source,cmd,...) if not (...) then return outputChatBox("/"..cmd.." [ID/ VehicleName]",source) end local playerX, playerY, playerZ = getElementPosition(source) local vehicleName = table.concat({...}, "") local vehicleID = getVehicleModelFromName(vehicleName) local createdVehicle = createVehicle(vehicleID or vehicleName,playerX,playerY,playerZ) vehicleSlotID = vehicleSlotID+1 warpPedIntoVehicle(source, createdVehicle) end) Link to comment
DNL291 Posted July 25, 2017 Share Posted July 25, 2017 Try this: local disallowedVehs = { [435] = true, [441] = true, [449] = true } local vehicleSlotID = 0 addCommandHandler("makeveh",function(source,cmd, vehicle) if not vehicle then return outputChatBox("/"..cmd.." [ID/ VehicleName]",source) end local playerX, playerY, playerZ = getElementPosition(source) local vehID = tonumber(vehicle) and tonumber(vehicle) or getVehicleModelFromName(vehicle) if vehID and not disallowedVehs[ vehID ] then local createdVehicle = createVehicle(vehID,playerX,playerY,playerZ) vehicleSlotID = vehicleSlotID+1 warpPedIntoVehicle(source, createdVehicle) end end) Not tested, just add the blocked vehicles in the table. 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