uniunicorn Posted October 5, 2019 Share Posted October 5, 2019 Code: function checkCarJack(thePlayer, seat, jacked) veh = getPedOccupiedVehicleSeat(jacked) if jacked and veh == 0 then cancelEvent() outputChatBox("[!] #f0f0f0CarJack atmanız yasaklanmıştır!", 255, 0, 0,player, true) end end addEventHandler("onVehicleStartEnter", getRootElement(), checkCarJack) Console Error: Bad Argument @ 'getPedOccupiedVehicleSeat' [Expected ped at argument 1, got boolean] How can i solve this? Can you help me? Link to comment
Castillo Posted October 5, 2019 Share Posted October 5, 2019 Why are you even using that function in the first place? the event 'onVehicleStartEnter' already provides the seat. About the error itself, it's most likely caused because the vehicle you tried to enter has no driver, so 'jacked' returns false. Link to comment
uniunicorn Posted October 5, 2019 Author Share Posted October 5, 2019 You mean what? I didn't understand, can you edit my code ? Link to comment
justn Posted October 5, 2019 Share Posted October 5, 2019 (edited) 23 minutes ago, uniunicorn said: You mean what? I didn't understand, can you edit my code ? He's saying there was no reason to use 'getPedOccupiedVehicleSeat' as the seat is already provided , so checking for the player's seat is completely pointless. This would be your new code. function checkCarJack(thePlayer, seat, jacked) if ( jacked ) and ( seat == 0 ) then outputChatBox("[!] #f0f0f0CarJack atmanız yasaklanmıştır!", thePlayer, 255, 0, 0, true) cancelEvent() end end addEventHandler("onVehicleStartEnter", getRootElement(), checkCarJack) Edited October 5, 2019 by Shux Fixed 1 minor thing. Link to comment
uniunicorn Posted October 5, 2019 Author Share Posted October 5, 2019 Thank you so much! 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