Jump to content

Bad Argument 'getPedOccupiedVehicleSeat'


uniunicorn

Recommended Posts

Posted

Code:

  1. function checkCarJack(thePlayer, seat, jacked)
  2. veh = getPedOccupiedVehicleSeat(jacked)
  3.  
  4. if jacked and veh == 0 then
  5. cancelEvent()
  6. outputChatBox("[!] #f0f0f0CarJack atmanız yasaklanmıştır!", 255, 0, 0,player, true)
  7. end
  8. end
  9. 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?

Posted

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.

Posted (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 by Shux
Fixed 1 minor thing.

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...