Jump to content

warpPedIntoVehicle issue


Absence2

Recommended Posts

Ok, so I have a problem with warpPedIntoVehicle, from time to time, it works perfectly fine. But sometimes it doesn't for a period of time. What I'm saying is, it doesn't warp.

For an example, lil toady's admin panel. The vehicle just spawns on the ped.

And when I use:

local jobMarker = createMarker(1808.1796875, -1916.625, 12.56644821167, "cylinder", 2, 0, 255, 255, 100 ) 
  
function jobMarkerHit( hitElement, matchingDimension ) 
    if isElementWithinMarker(hitElement, jobMarker) then 
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then 
        local vehicle = createVehicle(431, 1798.38171, -1929.55750, 13.38790) 
        setPlayerTeam ( hitElement, Bus) 
    warpPedIntoVehicle(hitElement, vehicle) 
  elseif getElementType( hitElement ) == "vehicle" then 
  end 
end 
end 
addCommandHandler("acceptjob", jobMarkerHit)  

The vehicle spawns on the given position: 1798.38171, -1929.55750, 13.38790 (line 6) and I don't warp inside it. Is there any way to solve this? It ruins a lot and is quite annoying,

also I noticed lil toady's slap mechanism, same thing there.

Link to comment

Thanks, I'll post what I discovered just now there.

Sharing it here is just as good I guess, so what I found was,

when I first connect to the server. and use the script above^ It does NOT work. HOWEVER, if I kill myself, go back and try again, it works. I guess I found the problem, kinda, but not a solution :( Anyhow, I'll report it there.

Link to comment

No, I just connect, go to the marker and use /acceptjob. The vehicle spawns but I don't warp. I then tried killing myself, then I went back and then vehicle spawns & I warp into the vehicle :D. But that doesn't solve much >.<

I tested with a timer on warpPedIntoVehicle but didn't work either, same results, I suppose it's MTA bug then

setTimer( warpPedIntoVehicle, 1500, 1,hitElement, vehicle)

also I tried being inside a vehicle before killing myself and not being in one. Same result. I have to die in order to make warpPedIntoVehicle work for me. I don't know if players has to do it too or if only one has to do it

Link to comment

try this

local jobMarker = createMarker(1808.1796875, -1916.625, 12.56644821167, "cylinder", 2, 0, 255, 255, 100 ) 
  
function jobMarkerHit( hitElement, matchingDimension ) 
    if isElementWithinMarker(hitElement, jobMarker) then 
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then 
        local vehicle1 = createVehicle(431, 1798.38171, -1929.55750, 13.38790) 
        if vehicle1 then 
        warpPedIntoVehicle(hitElement, vehicle1) 
        setPlayerTeam ( hitElement, Bus) 
end 
end 
end 
end 
addCommandHandler("acceptjob", jobMarkerHit)  

and make sure its ServerSide in meta.xml !

Link to comment
local jobMarker = createMarker(1808.1796875, -1916.625, 12.56644821167, "cylinder", 2, 0, 255, 255, 100 ) 
  
function jobMarkerHit(p,d) 
   if getElementType(p) == "player" and not isPedInVehicle(p) and d then 
        local v = createVehicle(431, 1798.38171, -1929.55750, 13.38790) 
        spawnPlayer(p, 1798, -1929, 13) 
        if vehicle1 then 
            setTimer(warpPedIntoVehicle, 50, 1, p, v) 
            setPlayerTeam ( p, Bus) 
        end 
    end 
end 
addCommandHandler("acceptjob", jobMarkerHit)  

this WILL work. or tommy vercetti will die

Link to comment
  
local jobMarker = createMarker(1808.1796875, -1916.625, 12.56644821167, "cylinder", 2, 0, 255, 255, 100 ) 
  
function jobMarkerHit(p,d) 
   if getElementType(p) == "player" and not isPedInVehicle(p) and d then 
        local v = createVehicle(431, 1798.38171, -1929.55750, 13.38790) 
        spawnPlayer(p, 1798, -1929, 13) 
        if v  then 
            setTimer(warpPedIntoVehicle, 50, 1, p, v) 
            setPlayerTeam ( p, Bus) 
        end 
    end 
end 
addCommandHandler("acceptjob", jobMarkerHit) 

It's not working becouse you are a lazy to check if the code is right.. bad for you, scripter.

Link to comment

This works fine to me...

  
local jobMarker = createMarker(1808.1796875, -1916.625, 12.56644821167, "cylinder", 2, 0, 255, 255, 100 ) 
  
function jobMarkerHit ( hitElement, matchingDimension ) 
    if isElementWithinMarker ( hitElement, jobMarker ) then 
        if getElementType( hitElement ) == "player" and not getPedOccupiedVehicle ( hitElement ) then 
            local vehicle = createVehicle ( 431, 1798.38171, -1929.55750, 13.38790 ) 
            setPlayerTeam ( hitElement, getTeamFromName ( "Bus" ) ) 
            warpPedIntoVehicle ( hitElement, vehicle, 0 ) 
        end 
    end 
end 
addCommandHandler ( "acceptjob", jobMarkerHit ) 

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