Jump to content

create car


rogerioexper

Recommended Posts

mkl - createmaker(1274.0817871094, -1657.0938720703, 13.546875 ,"cylinder" 1.5 , 0, 255, 0, 255)

function createVehicleForPlayer(thePlayer, command, vehicleModel)
    local x 1274.0817871094,y -1657.0938720703,z 13.546875 = getElementPosition(thePlayer)
    x = x + 5 adiciona 5 unidades na variável x
        local createdVehicle = createVehicle(tonumber(VechicleModel),x,y,z)
        if (createdVehicle == false) then
        outputChatBox("Could not create the vehicle . The syntax is: /createvehicle [597]",thePlayer)
    end

someone help this giving error "-" "=" expected near

I need a lot of help from some script

Link to comment

It's so bad that code. Use this i think:

mkl - createmaker(1274.0817871094, -1657.0938720703, 13.546875 ,"cylinder" 1.5 , 0, 255, 0, 255)
function createVehicleForPlayer( player, cmd, model )
	local model = tonumber( model )
	if model then
		local x, y, z = getElementPosition( player )
		local vehicle = createVehicle( model, x, y, z )
	else
		outputChatBox( "Syntax: /"..cmd.." [model]", player, 255, 255, 255 )
	end
end

 

  • Like 1
Link to comment
local mkl = createMarker ( 1274.0817871094, -1657.0938720703, 13.546875 ,"cylinder", 1.5, 0, 255, 0, 255 )

function createVehicleForPlayer ( thePlayer, _, vehicleModel )
	local vehicleModel = tonumber ( vehicleModel )
    local x ,y ,z = getElementPosition ( thePlayer )
    --x = x + 5 adiciona 5 unidades na variável x
    local createdVehicle = createVehicle ( vehicleModel, x + 5, y, z )
    if ( not createdVehicle ) then
		outputChatBox ( "Could not create the vehicle . The syntax is: /createvehicle [597]", thePlayer, 255, 0, 0 )
	else 
		outputChatBox ( "The vehicle was created successfully.", thePlayer, 0, 255, 0 )
	end 
end 

 

  • Like 1
Link to comment
3 hours ago, rogerioexper said:

 

Thank you so much

 

 

it activates the marker more does not create the vehicle friend

 

It would not create the vehicle when you hit the marker. Your script is kinda made for a command.

This means uou gotta add:

addCommandHandler("car",createVehicleForPlayer) or add an event handler that triggers when you hit the marker - with a bit of parameters changes

  • Like 1
Link to comment
local mkl = createMarker ( 1274.0817871094, -1657.0938720703, 13.546875 ,"cylinder", 1.5, 0, 255, 0, 255 )

local vehID = 597
function createVehicleForPlayer ( thePlayer )
    local x ,y ,z = getElementPosition ( thePlayer )
    local createdVehicle = createVehicle ( vehID, x + 5, y, z )
    if ( not createdVehicle ) then
		outputChatBox ( "Error spawning vehicle.", thePlayer, 255, 0, 0 )
    else 
    	outputChatBox ( "The vehicle was created successfully.", thePlayer, 0, 255, 0 )
    end 
end 
addEventHandler( "onMarkerHit", mkl, createVehicleForPlayer )

 

Edited by ..:D&G:..
  • Like 1
Link to comment
local mkl = createMarker ( 1274.0817871094, -1657.0938720703, 13.546875 ,"cylinder", 1.5, 0, 255, 0, 255 )

function createVehicleForPlayer ( thePlayer )
	if thePlayer and getElementType( thePlayer ) == "player" and not isPedInVehicle (thePlayer) then 
		local x ,y ,z = getElementPosition ( thePlayer )
		local createdVehicle = createVehicle (597, x + 5, y, z )
		if ( not createdVehicle ) then
			outputChatBox ( "Error spawning vehicle.", thePlayer, 255, 0, 0 )
		else 
			outputChatBox ( "The vehicle was created successfully.", thePlayer, 0, 255, 0 )
		end 
	end 
end 
addEventHandler( "onMarkerHit", mkl, createVehicleForPlayer )

 

Edited by Walid
  • Like 1
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...