MarbleXeno Posted February 18, 2020 Share Posted February 18, 2020 (edited) So, hello. 2 hours ago I wrote that I have a problem with the script. I have him again. But i think, I'm doing everything right now, I don't know what's going on. I am new, so for many the solution can be simple, for me, it is not. I will be very grateful if someone helps me. After writing command "/createveh" nothing is happening, i don't know why. SCRIPT (skrypt.Lua) function createSomeVehicle() x, y, z = getElementPosition(getPlayerFromName("Xeno")) createVehicle(400, x, y, z) end addCommandHandler("createveh", createSomeVehicle) meta.xml <meta> <source src="skrypt.Lua" type="server" /> </meta> Edited February 18, 2020 by MarbleXeno Link to comment
Moderators Patrick Posted February 18, 2020 Moderators Share Posted February 18, 2020 (edited) Try to debug it for yourself, here is some help: https://wiki.multitheftauto.com/wiki/HU/Meta.xml https://wiki.multitheftauto.com/index.php?title=Debugging https://forum.multitheftauto.com/topic/121619-Lua-for-absolute-beginners/ Edited February 18, 2020 by Patrick Link to comment
#\_oskar_/# Posted February 18, 2020 Share Posted February 18, 2020 use > getPlayerName for check your name Link to comment
ReZurrecti0n Posted February 18, 2020 Share Posted February 18, 2020 (edited) function createSomeVehicle(player, command) -- I believe the player and command arguments are passed automatically when it comes to the Command Handler local x, y, z = getElementPosition(player) -- Because we don't need the x, y or z variables after this function, should make those variables local createVehicle(400, x, y, z) end addCommandHandler("createveh", createSomeVehicle) However, I did not spot anything wrong with the code you posted, it should have worked as far as I can tell. May seem silly, but are you certain your player name was in fact "Xeno" at the time of using the command? Also, if there are any missing thens or ends, that will stop a script from even loading up. Missing ( )s, accidentally using a . when it should be a , etc etc etc getElementPosition(Element) - You need the player element, NOT a player name: He was just getting the player element from the player name "Xeno" Edited February 18, 2020 by ReZurrecti0n 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