Perfect Posted April 22, 2012 Share Posted April 22, 2012 Hi All , my script not working at all. I don't know why because i am beginner here it's my scripte addCommandHandler("vehiclecontrol", function(theVehicle, command, source) if source then if getVehicleFromName(vehicle) then local vehicle = getVehicleFromName(vehicle) local theVehicle = thevehicle setCameraTarget(thePlayer, player) toggleAllControls(vehicle, false) toggleControl(vehicle, "chatbox", true) toggleControl(vehicle, "playerlist", true) function bindEightDown() setElementData(theVehicle, "Player Pressing 8", true) end bindKey(thePlayer, "num_8", "down", bindEightDown) bindKey(thePlayer, "num_8", "up", bindEightUp) bindKey(thePlayer, "num_4", "down", bindFourDown) bindKey(thePlayer, "num_4", "up", bindFourUp) bindKey(thePlayer, "num_6", "down", bindSixDown) bindKey(thePlayer, "num_6", "up", bindSixUp) bindKey(thePlayer, "num_2", "down", bindTwoDown) bindKey(thePlayer, "num_2", "up", bindTwoUp) bindKey(thePlayer, "num_5", "down", bindFiveDown) bindKey(thePlayer, "num_5", "up", bindFiveUp) setVehicleControl(True) function() setControlState(player, "brake_reverse", true) else setControlState(player, "brake_reverse", true) end setControlState(player, "accelerate", true) else setControlState(player, "accelerate", true) end setControlState(player, "vehicle_left", true) else setControlState(player, "vehicle_left", true) end setControlState(player, "vehicle_right", true) else setControlState(player, "vehicle_right", true) end end addEventHandler("onConsole", thePlayer, releaseControlCommand) EDIT: I want to control my vehicle with distance by using num keys. Link to comment
Kenix Posted April 22, 2012 Share Posted April 22, 2012 Your syntax wrong. Use /debugscript 3 in next time. Link to comment
Perfect Posted April 23, 2012 Author Share Posted April 23, 2012 can you give me right one please ? Link to comment
Absence2 Posted April 23, 2012 Share Posted April 23, 2012 use /debugscript 3 In-Game or http://www.lua.org/cgi-bin/demo https://wiki.multitheftauto.com/wiki/Debugging Link to comment
Puma Posted April 23, 2012 Share Posted April 23, 2012 Why don't you tell him what /debugscript is for? If you are logged in as an admin, you can use the "/debugscript 3" command. It creates some sort of chatbox at the bottom of your screen and if a script isn't working, it outputs the reason for it in there. For example, it says syntax error in server.lua at line 32: bad argument at 'getElementPosition'. This means that in server.lua, line 32 there's something wrong in 'getElementPosition'. As for your script, you should start reading the page about 'addCommandHandler': https://wiki.multitheftauto.com/wiki/AddCommandHandler First parameter in the function you call is a player and yours is 'theVehicle'. Would be pretty weird if vehicles could use commands . You have to change it to 'player' for example and after that, you write 'theVehicle = getPedOccupiedVehicle ( player )'. Link to comment
Absence2 Posted April 23, 2012 Share Posted April 23, 2012 because i gave him a link. Debug consoleMTA features a built-in debug console that shows debug messages output from MTA functions or from scripts. You can open it by typing debugscript x in console, while x is the debug level: 1: only errors 2: errors and warnings 3: errors, warnings and info messages Thus, by typing debugscript 3 all messages are visible, that or level 2 are recommended for most occasions. You should have debugscript enabled most of the time you are testing your scripts, this will help you detect typos or other simple issues and solve them easily. Link to comment
Kenix Posted April 23, 2012 Share Posted April 23, 2012 Ok i did make it https://community.multitheftauto.com/index.php?p= ... ls&id=4574 Link to comment
Perfect Posted April 24, 2012 Author Share Posted April 24, 2012 Sorry for not reply (network off) . Ok i did make ithttps://community.multitheftauto.com/index.php?p= ... ls&id=4574 I don't i happy or sad because i want make script and post in community (my first script) . but i am happy also Because you make you make it . I am Happily Sad now!! : 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