Jump to content

Warp player into car


GhostXoP

Recommended Posts

Posted

I have tried to use

warpPedIntoVehicle(source, VEHICLE) 

and this does not seem to be working

How can i spawn the player into a vehicle otherwise?(This is server side within an event handler triggered by the player)

Posted

Well, if 'source' is defined and 'VEHICLE' as well, then it should work.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Mind posting your script?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
  
function SpawnPlayerInCar(Vehicle) 
    warpPedIntoVehicle(source,Vehicle) 
  
end 
  
addEvent("Server,PutMeInMyCar", true) 
addEventHandler("Server.PutMeInMyCar", getRootElement(), SpawnPlayerInCar) 

SERVERSIDE

--spawn the vehicle where player is but spawn player within it 
  
local x,y,z = getElementPosition(getLocalPlayer()) 
  
local spawnedVehicle = createVehicle(Item.ID, x,y,z, 0, 0, 0, Item.LIC) 
  
triggerServerEvent("Server.PutMeInMyCar", getLocalPlayer(), spawnedVehicle) 

CLIENTSIDE

Posted

You can't warp him because the vehicle is created client side, so the server doesn't know about it.

Create the vehicle server side.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

The vehicle doesn't exist on the server. It was created by the client and only exists on the client. You can't pass elements or other userdata if they do not exist on the other side.

-

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