Jump to content

Help getElementPosition (Player)


Brad96

Recommended Posts

Help, I'm new to making my own script, and I know that I explain how optener Player position with getRoolElement .. and tried several things but nothing .. I might say? thanks

function CrearCoche 
local x,y,z = getElementPosition( LocalPlayer ) 
Auto = createVehicle ( 411, x, y, z, 0, 0, 90, "BradFord" ) 
setVehicleColor (Auto, 255,0,0) 
end 
addEventHandler ("onResourceStart", getRootElement(), CrearCoche) 
  

Link to comment

The onResourceStart doens´t know a localPlayer. The localPlayer is a predefined variable in the client side scripting. You can give everyone a vehicle with the onResourceStart. Since you only want to receive a car, try this command;

addCommandHandler("giveMeVehicle", 
    function ( thePlayer, command ) 
        local x, y, z = getElementPosition( thePlayer ); 
        local v = createVehicle(411, x, y, z, 0, 0, 90, "BradFord"); 
        if ( v ) then 
            setVehicleColor(v, 255, 0, 0); 
            warpPedIntoVehicle(thePlayer, v); 
        end 
    end 
); 

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