Jump to content

[HELP]Cannot enter spawned car


NotAvailable

Recommended Posts

Hi, im currently working on a Player Panel for my server.

So that they can spawn cars and so on.

But when i spawn a car, I cannot enter the car.

Heres the code(client-side):

  
    function sultan() 
    local client = getLocalPlayer() 
    local x,y,z = getElementPosition ( client ) 
    local r = getElementRotation ( client ) 
                vehicle = createVehicle ( 560, x, y+5, z+1, 0, 0, r ) 
                outputChatBox("Bulletproof sultan spawned!",  0, 255, 0, client) 
     end 
  

There are no errors in the code but when i spawn the car, I cannot enter it.

How to fix this?

Regards,

Jesseunit

Link to comment

still not working, i tried getPlayerFromName.

this is the code(client)

    function sultan() 
                triggerServerEvent("spawnSultan", getLocalPlayer()) 
     end 

this the server side code:

addEvent("spawnSultan", true)   
function warpIntoCar(playerName)     
local player = getPlayerFromName( playerName ); 
        local x, y, z = getElementPosition ( player ) 
        local r = getPedRotation ( player ) 
        vehicle = createVehicle ( 560, x, y, z, 0, 0, r ) 
        warpPedIntoVehicle ( player, vehicle ) 
end 
addEventHandler ( "spawnSultan", getRootElement(), warpIntoCar ) 

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