Brad96 Posted August 13, 2013 Share Posted August 13, 2013 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
tosfera Posted August 13, 2013 Share Posted August 13, 2013 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
Brad96 Posted August 13, 2013 Author Share Posted August 13, 2013 dont'work , but see addCommandHandler something is missing Link to comment
tosfera Posted August 13, 2013 Share Posted August 13, 2013 lmao it doesn't? You're telling me that it doesn't work? Where did you add it, client or server side? Cause mine is server sided. edit; just tested it and it works like a charm! Link to comment
Brad96 Posted August 13, 2013 Author Share Posted August 13, 2013 server side , and no , no work Link to comment
Brad96 Posted August 13, 2013 Author Share Posted August 13, 2013 yes but I'm noob in this, donot exactly what vaen addCommandHandler addCommandHandler("V",thePlayer () getRootElement ) This ? our what Link to comment
tosfera Posted August 13, 2013 Share Posted August 13, 2013 No, just copy the code into a server sided .lua file and restart your source, it works fine like this. Link to comment
Brad96 Posted August 13, 2013 Author Share Posted August 13, 2013 work! I appreciate that, now can you tell me as to which line you got the player's position and that you gave? Link to comment
isa_Khamdan Posted August 13, 2013 Share Posted August 13, 2013 work! I appreciate that, now can you tell me as to which line you got the player's position and that you gave? local x, y, z = getElementPosition( thePlayer ); local v = createVehicle(411, x, y, z, 0, 0, 90, "BradFord"); Link to comment
tosfera Posted August 14, 2013 Share Posted August 14, 2013 Just check out this function on the wiki (click on it) getElementPosition. it will give you an example how to use the function. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now