Jump to content

this time a question from me ;$


m4rsje

Recommended Posts

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 xD

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

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
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 :P 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 8)

addCommandHandler("vehicle", a)

its the command handler that gets the information about the function called >a<, when the command /vehicle ... is being called.

:D

Link to comment

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 :D

^^

Edited by Guest
Link to comment
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 :D

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 :D

^^

yeah nice work :) that one works! ;)

Link to comment
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 :D

^^

yeah nice work :) that one works! ;)

Thanks ^^

have fun with this .____.

Link to comment
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

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

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