I know if I do this for you, you won't learn anything but... I want to help newbies.
local allowedSerials = {
["SomeSerial"] = true, -- Change it to the players serial you want to grant access to /veh command
--["SomeSerial2"] = true
}
addCommandHandler("veh", function(thePlayer, cmd, vehid) -- Adding 'veh' command handler
if tonumber(vehid) then -- Check if the 'vehid' arg. is a number
if allowedSerials[getPlayerSerial(thePlayer)] then -- Check if the player using the command have his/her serial in the table
local vehname = getVehicleNameFromModel(tonumber(vehid)) -- Getting vehicle name
if vehname ~= "" then -- If vehicle name is not an empty string
local x, y, z = getElementPosition(thePlayer) -- Getting his/her positions
local veh = createVehicle(tonumber(vehid), x, y+3, z) -- Creating the vehicle near the player
if veh then -- If the vehicle created successfully
outputChatBox("Created vehicle: "..vehname, thePlayer) -- Output the created vehicle's name
end
else
outputChatBox("Please enter a valid vehicle model ID.", thePlayer) -- If the specified ID is not valid
end
else
outputChatBox("You don't have access to this command.", thePlayer) -- If the players serial is not in the table
end
else
outputChatBox("[SYNTAX]: /"..cmd.." [Model ID]", thePlayer) -- If the 'vehid' arg. is not specified or not a number
end
end)
I wrote some comments, read it, hope you understand how it works!