Jump to content

[Help] warp into vehicle


Deihim007

Recommended Posts

Hello Folks!

I need some help here;

Vehicles = { [468]=true,[577]=true }

function enterVehicle ( player, seat, jacked )
    if ( Vehicles[getElementModel(source)] ) then
        cancelEvent()
		warpPedIntoVehicle ( player, idk_what_to_put_here )
        outputChatBox ( "OK!", player )
    end
end
addEventHandler ( "onVehicleStartEnter", root, enterVehicle )

I want it to warp a player into specifics vehicles in attempt to enter.

Link to comment
Vehicles = {[468]=true,[577]=true}

function enterVehicle ( player, seat, jacked )
	if (Vehicles[getElementModel(source)]) then
		cancelEvent()
		warpPedIntoVehicle(player, source)
		outputChatBox( "OK!", player)
	end
end
addEventHandler("onVehicleStartEnter", root, enterVehicle)

Next time, check the wiki page.

Quote

The source of this event is the vehicle in which a player began to enter.

 

Link to comment
15 minutes ago, NeXuS™ said:

Vehicles = {[468]=true,[577]=true}

function enterVehicle ( player, seat, jacked )
	if (Vehicles[getElementModel(source)]) then
		cancelEvent()
		warpPedIntoVehicle(player, source)
		outputChatBox( "OK!", player)
	end
end
addEventHandler("onVehicleStartEnter", root, enterVehicle)

Next time, check the wiki page.

 

i tried source before i post, but nothing happens

Link to comment
Vehicles = { [468] = true,[577] = true };

function enterVehicle ( player, seat, jacked )
	if ( Vehicles [ getElementModel ( source ) ] ) then
		ssPlayer = source;
			setTimer ( function (	)
				warpPedIntoVehicle ( player, ssPlayer );
			end, 50, 1 );
		cancelEvent (	);
	end;
end;

addEventHandler ( "onVehicleStartEnter", root, enterVehicle );

 

  • Thanks 1
Link to comment
1 hour ago, #,+( _xiRoc[K]; > said:

Vehicles = { [468] = true,[577] = true };

function enterVehicle ( player, seat, jacked )
	if ( Vehicles [ getElementModel ( source ) ] ) then
		ssPlayer = source;
			setTimer ( function (	)
				warpPedIntoVehicle ( player, ssPlayer );
			end, 50, 1 );
		cancelEvent (	);
	end;
end;

addEventHandler ( "onVehicleStartEnter", root, enterVehicle );

 

Wow! nicely done, thanks.

May i ask what caused it to not 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...