xyz Posted April 5, 2016 Share Posted April 5, 2016 function vctint(player) if isPedInVehicle(player) == true then cancelEvent() else setElementInterior(player, 5) setElementDimension(player, 1) setElementPosition(player, 225.0107421875, -8.0927734375, 1002.2109375) setElementRotation(player, 0, 0, 90, "default", true) setCameraTarget(player) end end addEventHandler("onMarkerHit", vctIn, vctint) So, when I'm trying to enter the marker it works all fine, but with a vehicle it still enters and outputs an error. I can't find a way to fix it. Bad argument @ 'isPedInVehicle' [Expected ped at argument 1, got vehicle] Link to comment
Anubhav Posted April 5, 2016 Share Posted April 5, 2016 It is because the hit element is vehicle... and you are using isPedInVehicle because it's giving a vehicle. So you should use "not getElementType(player) == "vehicle" ". Link to comment
Miika Posted April 5, 2016 Share Posted April 5, 2016 Try this: function vctint(thePlayer) if not (isPedInVehicle(thePlayer)) then setElementInterior(thePlayer, 5) setElementDimension(thePlayer, 1) setElementPosition(thePlayer, 225.0107421875, -8.0927734375, 1002.2109375) setElementRotation(thePlayer, 0, 0, 90, "default", true) setCameraTarget(thePlayer, thePlayer) end end addEventHandler("onMarkerHit", vctIn, vctint) Btw, you cannot use setCameraTarget without giving the taget. Link to comment
xyz Posted April 6, 2016 Author Share Posted April 6, 2016 Still haven't got it working Link to comment
xyz Posted April 6, 2016 Author Share Posted April 6, 2016 Still haven't got it working Link to comment
Anubhav Posted April 6, 2016 Share Posted April 6, 2016 Still haven't got it working See my post please, also the setCameraTarget Link to comment
Anubhav Posted April 6, 2016 Share Posted April 6, 2016 Still haven't got it working See my post please, also the setCameraTarget Link to comment
xyz Posted April 6, 2016 Author Share Posted April 6, 2016 Still haven't got it working See my post please, also the setCameraTarget I tried that but couldn't get it working, can I have an example? Link to comment
xyz Posted April 6, 2016 Author Share Posted April 6, 2016 Still haven't got it working See my post please, also the setCameraTarget I tried that but couldn't get it working, can I have an example? Link to comment
Captain Cody Posted April 6, 2016 Share Posted April 6, 2016 function vctint(thePlayer) if not getElementType(thePlayer) == "vehicle" then if isPedInVehicle(thePlayer) then return end setElementInterior(thePlayer, 5) setElementDimension(thePlayer, 1) setElementPosition(thePlayer, 225.0107421875, -8.0927734375, 1002.2109375) setElementRotation(thePlayer, 0, 0, 90, "default", true) setCameraTarget(thePlayer, thePlayer) end end addEventHandler("onMarkerHit", vctIn, vctint) Link to comment
Captain Cody Posted April 6, 2016 Share Posted April 6, 2016 function vctint(thePlayer) if not getElementType(thePlayer) == "vehicle" then if isPedInVehicle(thePlayer) then return end setElementInterior(thePlayer, 5) setElementDimension(thePlayer, 1) setElementPosition(thePlayer, 225.0107421875, -8.0927734375, 1002.2109375) setElementRotation(thePlayer, 0, 0, 90, "default", true) setCameraTarget(thePlayer, thePlayer) end end addEventHandler("onMarkerHit", vctIn, vctint) Link to comment
xyz Posted April 6, 2016 Author Share Posted April 6, 2016 Dunno if I'm going crazy, that doesn't work either. ._. Link to comment
xyz Posted April 6, 2016 Author Share Posted April 6, 2016 Dunno if I'm going crazy, that doesn't work either. ._. Link to comment
Anubhav Posted April 7, 2016 Share Posted April 7, 2016 function vctint(thePlayer) if getElementType(thePlayer) == "player" then if isPedInVehicle(thePlayer) then return end setElementInterior(thePlayer, 5) setElementDimension(thePlayer, 1) setElementPosition(thePlayer, 225.0107421875, -8.0927734375, 1002.2109375) setElementRotation(thePlayer, 0, 0, 90, "default", true) setCameraTarget(thePlayer, thePlayer) end end addEventHandler("onMarkerHit", vctIn, vctint) + make sure vctIn is a marker variable. + dont go in it with a vehicle Link to comment
Anubhav Posted April 7, 2016 Share Posted April 7, 2016 function vctint(thePlayer) if getElementType(thePlayer) == "player" then if isPedInVehicle(thePlayer) then return end setElementInterior(thePlayer, 5) setElementDimension(thePlayer, 1) setElementPosition(thePlayer, 225.0107421875, -8.0927734375, 1002.2109375) setElementRotation(thePlayer, 0, 0, 90, "default", true) setCameraTarget(thePlayer, thePlayer) end end addEventHandler("onMarkerHit", vctIn, vctint) + make sure vctIn is a marker variable. + dont go in it with a vehicle Link to comment
KariiiM Posted April 7, 2016 Share Posted April 7, 2016 if not getElementType(thePlayer) == "vehicle" then Of course 'thePlayer' won't be a vehicle Link to comment
KariiiM Posted April 7, 2016 Share Posted April 7, 2016 if not getElementType(thePlayer) == "vehicle" then Of course 'thePlayer' won't be a vehicle Link to comment
Anubhav Posted April 7, 2016 Share Posted April 7, 2016 if not getElementType(thePlayer) == "vehicle" then Of course 'thePlayer' won't be a vehicle Do you even know you can name arguments of a function anything with a few exceptions? onMarkerHit gives a element and he just defined it as thePlayer, so now thePlayer holds the value that which element hit it. Link to comment
Anubhav Posted April 7, 2016 Share Posted April 7, 2016 if not getElementType(thePlayer) == "vehicle" then Of course 'thePlayer' won't be a vehicle Do you even know you can name arguments of a function anything with a few exceptions? onMarkerHit gives a element and he just defined it as thePlayer, so now thePlayer holds the value that which element hit it. Link to comment
KariiiM Posted April 7, 2016 Share Posted April 7, 2016 if not getElementType(thePlayer) == "vehicle" then Of course 'thePlayer' won't be a vehicle Do you even know you can name arguments of a function anything with a few exceptions? onMarkerHit gives a element and he just defined it as thePlayer, so now thePlayer holds the value that which element hit it. Yes I know thePlayer in this case means the element who hits the specify marker, but instead of doing that check he can check dirrectly if the element's type is equal to player or else. Because, by doing this check if not getElementType(thePlayer) == "vehicle" then it will clearly let the ability to other elements that might hit the marker later Link to comment
KariiiM Posted April 7, 2016 Share Posted April 7, 2016 if not getElementType(thePlayer) == "vehicle" then Of course 'thePlayer' won't be a vehicle Do you even know you can name arguments of a function anything with a few exceptions? onMarkerHit gives a element and he just defined it as thePlayer, so now thePlayer holds the value that which element hit it. Yes I know thePlayer in this case means the element who hits the specify marker, but instead of doing that check he can check dirrectly if the element's type is equal to player or else. Because, by doing this check if not getElementType(thePlayer) == "vehicle" then it will clearly let the ability to other elements that might hit the marker later Link to comment
Anubhav Posted April 7, 2016 Share Posted April 7, 2016 if not getElementType(thePlayer) == "vehicle" then Of course 'thePlayer' won't be a vehicle Do you even know you can name arguments of a function anything with a few exceptions? onMarkerHit gives a element and he just defined it as thePlayer, so now thePlayer holds the value that which element hit it. Yes I know thePlayer in this case means the element who hits the specify marker, but instead of doing that check he can check dirrectly if the element's type is equal to player or else. Because, by doing this check if not getElementType(thePlayer) == "vehicle" then it will clearly let the ability to other elements that might hit the marker later Did you even read my post about this? I did the check if he is player then go forward otherwise no. Link to comment
Anubhav Posted April 7, 2016 Share Posted April 7, 2016 if not getElementType(thePlayer) == "vehicle" then Of course 'thePlayer' won't be a vehicle Do you even know you can name arguments of a function anything with a few exceptions? onMarkerHit gives a element and he just defined it as thePlayer, so now thePlayer holds the value that which element hit it. Yes I know thePlayer in this case means the element who hits the specify marker, but instead of doing that check he can check dirrectly if the element's type is equal to player or else. Because, by doing this check if not getElementType(thePlayer) == "vehicle" then it will clearly let the ability to other elements that might hit the marker later Did you even read my post about this? I did the check if he is player then go forward otherwise no. Link to comment
KariiiM Posted April 7, 2016 Share Posted April 7, 2016 Did you even read my post about this? I did the check if he is player then go forward otherwise no. Yeah I just saw that Link to comment
KariiiM Posted April 7, 2016 Share Posted April 7, 2016 Did you even read my post about this? I did the check if he is player then go forward otherwise no. Yeah I just saw that 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