Jump to content

Vehicle lower name


DarkByte

Recommended Posts

Posted

Hi i made this script but its not working.

function getVehicleModelFromName(vehId) 
    local vehiclen = getVehicleModelFromName(vehID) 
    if vehiclen then 
        return vehiclen 
    end 
    for _,vehiclen in ipairs(getElementsByType("vehicle")) do 
        if string.find(string.gsub(getVehicleModelFromName(vehId):lower(),"#%x%x%x%x%x%x", ""), getVehicleModelFromName:lower(), 1, true) then 
            return vehiclen 
        end 
    end 
return false 
end 
  

When I hear someone saying Mac is better than PC.

o0pjNKG.gif w0t?VeJXjxD.gifw0t? evspcFJ.gifw0t?

Great minds discuss ideas, average minds discuss events and small minds discuss people.

Posted
getVehicleNameFromModel_ = getVehicleNameFromModel 
  
function getVehicleNameFromModel(vehID) 
    local vehiclen = getVehicleNameFromModel_(vehID) 
    if vehiclen then 
        return vehiclen:lower() 
    end 
    return false 
end 

OR try to explain better.

CiTLh.png
Posted

I want to create vehicles by a lower name and get them from tables and then insert the script in this one.

function createVehicleCommand(cmd, ...) 
    local vehID 
    local vehiclesToCreate = {} 
    local elem = getPedOccupiedVehicle(g_Me) 
    local args = { ... } 
    for i,v in ipairs(args) do 
        vehID = tonumber(v) 
        if not vehID then 
            vehID = getVehicleModelFromName(v) 
        end 
        if elem then 
        errMsg('• Please leave the vehicle to create another one!') 
        return 
        end 
        if vehID then 
            table.insert(vehiclesToCreate, math.floor(vehID)) 
        end 
    end 
    server.giveMeVehicles(vehiclesToCreate) 
end 
addCommandHandler('createvehicle', createVehicleCommand) 
addCommandHandler('cv', createVehicleCommand) 

When I hear someone saying Mac is better than PC.

o0pjNKG.gif w0t?VeJXjxD.gifw0t? evspcFJ.gifw0t?

Great minds discuss ideas, average minds discuss events and small minds discuss people.

Posted

Anyone?

When I hear someone saying Mac is better than PC.

o0pjNKG.gif w0t?VeJXjxD.gifw0t? evspcFJ.gifw0t?

Great minds discuss ideas, average minds discuss events and small minds discuss people.

Posted

Not quite sure what you're asking for... Do you mean custom names, or what?

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

Posted

Yea, and got vehicle name by a lower name like /cv bugatti and get vehicle name from tables.

When I hear someone saying Mac is better than PC.

o0pjNKG.gif w0t?VeJXjxD.gifw0t? evspcFJ.gifw0t?

Great minds discuss ideas, average minds discuss events and small minds discuss people.

Posted

This?

function createVehicleCommand(cmd, ...) 
    local vehiclesToCreate = {} 
    local args = { ... } 
    local vehID = tonumber(args[1]) 
    if getPedOccupiedVehicle(g_Me) then 
        return errMsg('• Please leave the vehicle to create another one!') 
    end 
    if not vehID then 
        for i=400, 611 do 
            if getVehicleNameFromModel(i):lower():find(table.concat(args, ", "):lower(), 1, true) then 
                vehID = i 
                break 
            end 
        end 
    end 
    if vehID then 
        table.insert(vehiclesToCreate, math.floor(vehID)) 
    end 
    server.giveMeVehicles(vehiclesToCreate) 
end 
addCommandHandler('createvehicle', createVehicleCommand) 
addCommandHandler('cv', createVehicleCommand) 

CiTLh.png
Posted

Working but how to create vehicle by their custom name like /cv bugatti or /cv lamborghini ?

When I hear someone saying Mac is better than PC.

o0pjNKG.gif w0t?VeJXjxD.gifw0t? evspcFJ.gifw0t?

Great minds discuss ideas, average minds discuss events and small minds discuss people.

Posted

Anyone?

When I hear someone saying Mac is better than PC.

o0pjNKG.gif w0t?VeJXjxD.gifw0t? evspcFJ.gifw0t?

Great minds discuss ideas, average minds discuss events and small minds discuss people.

Posted

How to make weapons lower name?

function giveWeaponCommand(cmd, weapon, amount) 
    weapon = tonumber(weapon) or getWeaponIDFromName(weapon) 
    if not weapon then 
        return 
    end 
    amount = amount and tonumber(amount) or 500 
    server.giveMeWeapon(math.floor(weapon), amount) 
end 
addCommandHandler('give', giveWeaponCommand) 
addCommandHandler('wp', giveWeaponCommand) 

When I hear someone saying Mac is better than PC.

o0pjNKG.gif w0t?VeJXjxD.gifw0t? evspcFJ.gifw0t?

Great minds discuss ideas, average minds discuss events and small minds discuss people.

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