Hey guys,
Im new to scripting and just looking for a bit of help. (your obviously going to realise im new after reading my question haha)
So anyway, i have been reading through the tutorials on the mtawiki and im having a bit of trouble. Im not to sure how to structure my scripting and generaly what to do, i get the idea and i know that i can use the Server Functions List page which is really helpful. But yeh I followed the tutorial and i got to trying to make a command. That worked fine but i just want to know is there anything i should be doing in regards to how i structure my scripting, do i need a main() function? Please note i have no previous scripting experience although i have read through some other language tutorials such as VB
Thanks guys.
here is my current script (one from the tut page)
function joinHandler()
local x = 1959.55
local y = -1714.46
local z = 20
spawnPlayer(source, x, y, z)
fadeCamera(source, true)
setCameraTarget(source, source)
outputChatBox("Welcome to My Server", source)
end
addEventHandler("onPlayerJoin", getRootElement(), joinHandler)
function createVehicleForPlayer(thePlayer, command, vehicleModel)
local x,y,z = getElementPosition(thePlayer)
x = x + 5
local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)
if (createdVehicle == false) then
outputChatBox("Vehicle Creation Failed.", thePlayer)
end
end
addCommandHandler("createvehicle", createVehicleForPlayer)