m4rsje Posted July 15, 2010 Share Posted July 15, 2010 okay guys, ive been alitle active on the forum last time, but now i got a question and i hope i can get support like i gave other people (A) ive been trying to make a command to create a vehicle. and ive been afk 3 times so i lost the way sometimes in this script anyway i got this: function a (cmd, ...) local x, y, z = getElementPosition (cmd) local vehID vehicle = createVehicle (vehID, x, y, z) warpPedIntoVehicle(cmd, vehicle) end addCommandHandler("vehicle", a) its suppose to create a vehicle that you call, like /vehicle nrg-500 thx Link to comment
50p Posted July 15, 2010 Share Posted July 15, 2010 I suppose you took this command from freeroam but because you have no idea what else you need, you ask here? Well, you code is wrong. Sometimes (I mean all the time) you have to think before you do something. Explain to me what is your code doing? Step by step, line by line and we'll see what you don't understand. Link to comment
m4rsje Posted July 15, 2010 Author Share Posted July 15, 2010 I suppose you took this command from freeroam but because you have no idea what else you need, you ask here? Well, you code is wrong. Sometimes (I mean all the time) you have to think before you do something. Explain to me what is your code doing? Step by step, line by line and we'll see what you don't understand. you busted me i did toke a look at freeroam but anyway:P function a (cmd, ...) Its the function name and cmd is the player. the dots are the text thats being filled in. local x,y,z = getElementPosition(cmd) It are the cords that you get from the player that types. local vehID its the ID thats being filled in. vehicle = createVehicle (vehId, x, y, z) its the vehicle thats being created, vehid = the id thats being token, x,y,z are the cords its getting spawned. wapPedIntoVehicle (cmd, vehicle) the player that types (cmd), is getting warped in to the vehicle thats being created (vehicle) end closes the function addCommandHandler("vehicle", a) its the command handler that gets the information about the function called >a<, when the command /vehicle ... is being called. Link to comment
Headshot4Fun Posted July 15, 2010 Share Posted July 15, 2010 (edited) What about: function createVehicleAndWarp (source, command, vehNAME) local x, y, z = getElementPosition (source) local vehID = getVehicleModelFromName(vehNAME) local vehicle = createVehicle (vehID, x, y, z) warpPedIntoVehicle(source, vehicle) end addCommandHandler("vehicle", createVehicleAndWarp) /vehicle nrg-500 ^^ Edited July 15, 2010 by Guest Link to comment
m4rsje Posted July 15, 2010 Author Share Posted July 15, 2010 What about: function createVehicleAndWarp (source, vehID) local x, y, z = getElementPosition (source) local vehicle = createVehicle (vehID, x, y, z) warpPedIntoVehicle(source, vehicle) end addCommandHandler("vehicle", createVehicleAndWarp) ^^ nice work so far but it aint creating the vehicle bec he doesn't know wich vehID you are calling so maybe better luck next time What about: function createVehicleAndWarp (source, command, vehNAME) local x, y, z = getElementPosition (source) local vehID = getVehicleModelFromName(vehNAME) local vehicle = createVehicle (vehID, x, y, z) warpPedIntoVehicle(source, vehicle) end addCommandHandler("vehicle", createVehicleAndWarp) /vehicle nrg-500 ^^ yeah nice work that one works! Link to comment
Headshot4Fun Posted July 15, 2010 Share Posted July 15, 2010 What about: function createVehicleAndWarp (source, vehID) local x, y, z = getElementPosition (source) local vehicle = createVehicle (vehID, x, y, z) warpPedIntoVehicle(source, vehicle) end addCommandHandler("vehicle", createVehicleAndWarp) ^^ nice work so far but it aint creating the vehicle bec he doesn't know wich vehID you are calling so maybe better luck next time What about: function createVehicleAndWarp (source, command, vehNAME) local x, y, z = getElementPosition (source) local vehID = getVehicleModelFromName(vehNAME) local vehicle = createVehicle (vehID, x, y, z) warpPedIntoVehicle(source, vehicle) end addCommandHandler("vehicle", createVehicleAndWarp) /vehicle nrg-500 ^^ yeah nice work that one works! Thanks ^^ have fun with this .____. Link to comment
dzek (varez) Posted July 16, 2010 Share Posted July 16, 2010 function a (cmd, ...) Its the function name and cmd is the player. the dots are the text thats being filled in. you failed at first line.. https://wiki.multitheftauto.com/wiki/AddCommandHandler Headshot4Fun, you think you did good thing,but you don't.. know that quote? Give a man a fish; you have fed him for today. Teach a man to fish ; and you have fed him for a lifetime he could learn how to make command handler, but you gave him complete script - so he will come back with same question in another code again.. Link to comment
Headshot4Fun Posted July 16, 2010 Share Posted July 16, 2010 varez, i was just trying to help... lol anyway, its a small and simple code, he just need practice. Link to comment
eAi Posted July 16, 2010 Share Posted July 16, 2010 He won't get that if people just tell him the code. Link to comment
Headshot4Fun Posted July 16, 2010 Share Posted July 16, 2010 Ok... lol function createVehicleAndWarp (source, command, vehNAME) -- creates the function createVehicleAndWarp getting the source player, command, and vehNAME (/command vehNAME) local x, y, z = getElementPosition (source) -- gets the source player position in GTA WORLD (x,y,z) local vehID = getVehicleModelFromName(vehNAME) -- gets the VEHICLE ID using the name (vehNAME) and store in vehID variable local vehicle = createVehicle (vehID, x, y, z) -- creates the vehicle with the id (VEHID) that we get with the name (VEHname) in the source player GTA WORLD position (x,y,z) warpPedIntoVehicle(source, vehicle) -- warp source player into the vehicle that we have created end -- ends the function with a cool name "createVehicleAndWarp" addCommandHandler("vehicle", createVehicleAndWarp) -- creates the command "/vehicle" and redirect the commnd to the function "createVehicleAndWarp got it now? D: Link to comment
m4rsje Posted July 16, 2010 Author Share Posted July 16, 2010 guys i know how it works i just.. didn't want to make it bec i was lazy Link to comment
Headshot4Fun Posted July 16, 2010 Share Posted July 16, 2010 guys i know how it works i just.. didn't want to make it bec i was lazy Lazy to add 2 more lines? D:Wow... 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