Deihim007 Posted July 14, 2017 Share Posted July 14, 2017 Hello people! I'm trying to write a script that allows player enter big planes like AT-400 without using a ladder. function warptovehicle () local id = getElementModel ( theVehicle ) if id == 577 then warpPedIntoVehicle ( thePlayer, theVehicle ) end end addEventHandler("onClientVehicleStartEnter",root,warptovehicle) [2017-07-14 08:00:42] WARNING: BigPlaneEnter\c_bigplane.lua:2: Bad argument @ 'getVehicleName' [Expected vehicle at argument 1, got nil] [2017-07-14 08:04:44] WARNING: BigPlaneEnter\c_bigplane.lua:2: Bad argument @ 'getElementModel' [Expected element at argument 1, got nil] Link to comment
Sticmy Posted July 14, 2017 Share Posted July 14, 2017 function warptovehicle (player, seat) local id = getElementModel ( source ) if id == 577 then warpPedIntoVehicle ( player, source ) end end addEventHandler("onClientVehicleStartEnter",root,warptovehicle) try it like this i have not tried it. Link to comment
koragg Posted July 14, 2017 Share Posted July 14, 2017 How do you get this error when you haven't used that function anywhere lol? [2017-07-14 08:00:42] WARNING: BigPlaneEnter\c_bigplane.lua:2: Bad argument @ 'getVehicleName' [Expected vehicle at argument 1, got nil] 1 Link to comment
Simple0x47 Posted July 14, 2017 Share Posted July 14, 2017 The question is, does the player move around the AT-400 because I think not when it's not around it's door so. [[CLIENT SIDE]] -- VARIABLES -- VEHICLES WARP local theVehicles = {} -- IN CASE YOU WANT IT FOR MORE VEHICLES JUST ADD VALUES TO THE TABLE, theVehicles[ vehicleID ] = true theVehicles[ 577 ] = true -- FUNCTIONS -- CHECK AND WARP local function vehicleWarp() if not ( isPedInVehicle( localPlayer ) ) then local vehicles = getElementsByType( "vehicles" ) for i = 1, #vehicles do local theVehicle = vehicles[ i ] if ( theVehicle ) then local vx, vy, vz, px, py, pz = getElementPosition( theVehicle ), getElementPosition( localPlayer ) if ( ( ( getDistanceBetweenPoints3D( vx, vy, vz, px, py, pz ) ) <= 5 ) and ( theVehicles[ getElementModel( theVehicle ) ] ) ) then triggerServerEvent( "onPlayerWarpIntoVehicle", localPlayer, theVehicle ) break end end end end end -- BIND KEYS bindKey( "enter_exit", "down", vehicleWrap ) [[ SERVER SIDE ]] -- EVENTS -- PLAYER WARP addEvent( "onPlayerWarpIntoVehicle", true ) -- FUNCTIONS -- PLAYER WARP local function playerWarp( theVehicle ) if ( ( source ) and ( theVehicle ) ) then local vehicleDriver = getVehicleOccupants( theVehicle ) vehicleDriver = vehicleDriver[ 1 ] or nil if ( vehicleDriver ) then removePedFromVehicle( vehicleDriver ) warpPedIntoVehicle( source, theVehicle, 0 ) else warpPedIntoVehicle( source, theVehicle, 0 ) end end end -- EVENT HANDLERS addEventHandler( "onPlayerWarpIntoVehicle", root, playerWarp ) 1 Link to comment
Deihim007 Posted July 15, 2017 Author Share Posted July 15, 2017 now i get this in client.log : [2017-07-15 10:21:18] WARNING: BigPlaneEnter\c_bigplane.lua:31: Bad argument @ 'bindKey' [Expected function at argument 3, got nil] Link to comment
Administrators Lpsd Posted July 15, 2017 Administrators Share Posted July 15, 2017 Look at the code carefully, it's not that hard to work out what's going wrong. Change the 3rd argument of 'bindKey' to be 'vehicleWarp' (there's currently a typo, 'vehicleWrap') Link to comment
Deihim007 Posted July 15, 2017 Author Share Posted July 15, 2017 1 hour ago, LopSided_ said: Look at the code carefully, it's not that hard to work out what's going wrong. Change the 3rd argument of 'bindKey' to be 'vehicleWarp' (there's currently a typo, 'vehicleWrap') oh didn't realized that but still nothing happens in attempt to enterVehicleStart Link to comment
Simple0x47 Posted July 15, 2017 Share Posted July 15, 2017 Its the bind key try to make bigger the distance between the 3d points. ( try to change 5 to 10 ). Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now