Godfather diesel Posted December 17, 2013 Posted December 17, 2013 hi guys, i really need help from u. im a newbie to sript writing.im learnin it aat mta wiki. i read the instructions and following them but im stuck somewhere i dont know. here it is : https://wiki.multitheftauto.com/wiki/Sc ... e_function heres my code for script.lua : local spawnX, spawnY, spawnZ = 1959.55, -1714.46, 10 function joinHandler() spawnPlayer(source, spawnX, spawnY, spawnZ) 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) -- get the position of the player x = x + 5 -- add 5 units to the x position local createdVehicle = createVehicle(tonumber(vehicleModel) ,x,y,z) -- check if the return value was ''false'' if (createdVehicle == false) then -- if so, output a message to the chatbox, but only to this player outputChatBox("Failed to create vehicle." ,thePlayer) end end addCommandHandler("createvehicle", createVehicleForPlayer) but when i run mta server, i types start myserver, i get this kind of eror : Start: Requested by Console Initiating changemode from 'play'to 'myserver' Start: Resource 'myserver' start was requested <> stopping play Stopping freeroam starting myserver SCRIPT ERROR : myserver\script.lua:10: '=' expected near 'getElementPosition' ERROR : @mapmanager\mapmanager_main.lua:376 loading script failed: myserver\script.lua:10: '=' expected near 'getElementPosition' Gamemode 'My Server' started Start Resource : Resource 'myserver' started help me plz, i really want to learn :"((( thnks guys for your precious time
xXMADEXx Posted December 17, 2013 Posted December 17, 2013 IT means that there is a "=" that isn't suppose to be there. The Ultimate Lua Tutorial! | MTA PHP SDK
denny199 Posted December 17, 2013 Posted December 17, 2013 Hi, welcome to our forums. Can you use next time the lua tags? [ lua] [/lua ] local spawnX, spawnY, spawnZ = 1959.55, -1714.46, 10 function joinHandler() spawnPlayer(source, spawnX, spawnY, spawnZ) 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) -- get the position of the player local x = x + 5 -- add 5 units to the x position local createdVehicle = createVehicle(tonumber(vehicleModel) ,x,y,z) -- check if the return value was ''false'' if (createdVehicle == false) then -- if so, output a message to the chatbox, but only to this player outputChatBox("Failed to create vehicle." ,thePlayer) end end addCommandHandler("createvehicle", createVehicleForPlayer) Sometimes I dream about cheese
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