Xwad Posted April 13, 2016 Share Posted April 13, 2016 I added some skins to vehicles so when i try to enter a vehicle i can cuz of the skin. So i decided to make a script that instantly warps the player into the vehicle when the player is trying to enter it. The only problem is that the player does not warp into the car.. i got no debugscript tanks = { [541]=true,[415]=true,[480]=true,[562]=true,[587]=true } function enterVehicle ( player, seat, jacked ) if ( tanks[getElementModel(source)] ) then outputChatBox ( "enter" ) cancelEvent() local x,y,z = getElementPosition(player) local x,y,z = getElementPosition(source) warpPedIntoVehicle ( player, source ) end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) Link to comment
Simple0x47 Posted April 13, 2016 Share Posted April 13, 2016 I think the problem why you cannot warp the player into the vehicle is because the default seat is occupied "seat id 0". So I would make a revision of the occupied seats in the vehicle and then warp the player into a free seat. getVehicleOccupants That's gonna return you a table, just make a "for" and look for the nil value in any of the keys to see any free seat in the vehicle. Link to comment
Xwad Posted April 13, 2016 Author Share Posted April 13, 2016 No i dont want to warp the player in other seats. I want to warp the player inside the vehicle. Becaouse i cant enter the vehicle cuz of the skin Link to comment
Seba500PLK Posted April 13, 2016 Share Posted April 13, 2016 tanks = { [541]=true,[415]=true,[480]=true,[562]=true,[587]=true } function enterVehicle ( player, seat, jacked ) if ( tanks[getElementModel(source)] ) then outputChatBox ( "enter" ) cancelEvent() warpPedIntoVehicle ( player, source,0 ) end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) Link to comment
Anubhav Posted April 14, 2016 Share Posted April 14, 2016 tanks = { [541]=true,[415]=true,[480]=true,[562]=true,[587]=true } function enterVehicle ( player, seat, jacked ) if ( tanks[getElementModel(source)] ) then outputChatBox ( "enter" ) cancelEvent() setTimer( warpPedIntoVehicle, 1500, 1, player, source,0 ) end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) Link to comment
Xwad Posted April 14, 2016 Author Share Posted April 14, 2016 Its working now thanks! Thanks to everybody!! 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