Jump to content

[HELP] All Vehicles


PleaseScript

Recommended Posts

Please someone help me I want the following when entering / allvehicles

It's the car I want so kind

/ allvehicles 512

Ae all server won the car 512 Could someone help me Thanks.

function consoleCreateVehicle ( sourcePlayer, commandName, ... ) 
   if ( sourcePlayer ) then 
      local x, y, z = getElementPosition ( sourcePlayer ) -- get the player's position 
      local vehicleName = table.concat({...}, " ") 
      local vehicleID = getVehicleModelFromName ( vehicleName ) 
            local newVehicle = createVehicle ( vehicleID, x, y, z ) 
            warpPedIntoVehicle (sourcePlayer , newVehicle )  
   end 
end 
addCommandHandler ( "allvehicle", consoleCreateVehicle ) 

Link to comment
addCommandHandler( "allvehicle",  
    function( p, _, value ) 
         
        --get player's position 
        local fX, fY, fZ = getElementPosition( p ) 
         
        --tries to find vehicle model 
        value = getVehicleModelFromName( value ) 
        if value then 
             
            --creates a new vehicle near the player 
            local _vehicle = createVehicle( value, fX, fY + 2.5, fZ ) 
            if _vehicle then 
                 
                --warps the player to it 
                warpPedIntoVehicle( p, _vehicle ) 
            end 
        else 
            outputChatBox( "Unable to find vehicle model!", p, 255, 0, 0, false ) 
        end 
    end 
) 

Not tested.

Link to comment
addCommandHandler( "allvehicle",  
    function( p, _, value ) 
         
        --get player's position 
        local fX, fY, fZ = getElementPosition( p ) 
         
        --tries to find vehicle model 
        value = getVehicleModelFromName( value ) 
        if value then 
             
            --creates a new vehicle near the player 
            local _vehicle = createVehicle( value, fX, fY + 2.5, fZ ) 
            if _vehicle then 
                 
                --warps the player to it 
                warpPedIntoVehicle( p, _vehicle ) 
            end 
        else 
            outputChatBox( "Unable to find vehicle model!", p, 255, 0, 0, false ) 
        end 
    end 
) 

Not tested.

NonO The Vehicle only doing this to me I wanted isse for all server; ( Please Help

Link to comment

He wants a command to set everyone's vehicle model to the one he choose.

addCommandHandler ( "allvehicles", 
    function ( thePlayer, _, model ) 
        local model = tonumber ( model ) 
        if ( model ) then 
            for _, player in ipairs ( getElementsByType ( "player" ) ) do 
                local vehicle = getPedOccupiedVehicle ( player ) 
                if ( vehicle ) then 
                    setElementModel ( vehicle, model ) 
                end 
            end 
        end 
    end 
) 

Should work.

Link to comment

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