Jump to content

Factions and vehicles


Recommended Posts

Hello, I need to make a code so that only those who are faction get on their vehicles, and those who are not do not get on, I do not know much about script and I need help :(
 
 
 
 
 
addCommandHandler"setvehiclefaction",
    functionplayercommandNameotherfaction )
        local faction = tonumber( faction )
        if other and faction and ( faction == 0 or exports.factions:getFactionName( faction ) ) then
            local other, name = exports.players:getFromName( player, other )
            if other then
                local vehicle = getPedOccupiedVehicle( other )
                if vehicle then
                    local data = vehicles[ vehicle ]
                    if data then
                        if data.vehicleID > 0 then
                            if data.characterID then
                                if exports.sql:query_free"UPDATE vehicles SET characterID = " .. -faction .. " WHERE vehicleID = " .. data.vehicleID ) then
                                    data.characterID = -faction
                                    outputChatBox"El " .. getVehicleName( vehicle ) .. " de "..name.." ahora pertenece a " .. ( faction == 0 and "ninguna faccion" or exports.factions:getFactionName( faction ) ) .. ".", player, 0255153 )
                                else
                                    outputChatBox"MySQL Query failed.", player, 25500 )
                                end
                            end
                        end
                    else
                        outputChatBox"Vehicle Error.", player, 25500 )
                    end
                else
                    outputChatBox( name .. " isn't driving a vehicle.", player, 25500 )
                end
            end
        else
            outputChatBox"Syntax: /" .. commandName .. " [player] [faction or 0 for no faction]", player, 255255255 )
        end
    end,
    true
)
 
Link to post

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