Jump to content

Problem with markers


xyz

Recommended Posts

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

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

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