Dzakub Posted November 10, 2009 Share Posted November 10, 2009 Hi. I wrote a script changing the vehicle if player is in other vehicle or creating vehicle if player is on foot. But the code does not run. I think i messed up something in If statement. Here is the code: addCommandHandler ( "sv", function ( thePlayer, command, newModel ) local theVehicle = getPedOccupiedVehicle ( thePlayer ) newModel = tonumber ( newModel ) if theVehicle and newModel then setElementModel ( theVehicle, newModel ) else if not theVehicle then local px, py, pz getElementPosition(thePlayer) local newVehicle = createVehicle(newModel, px, py, pz) warpPedIntoVehicle ( thePlayer, newVehicle ) end end ) Link to comment
Dark Dragon Posted November 10, 2009 Share Posted November 10, 2009 the problem here is that currently you are missing an "end", if you type "else if" instead of "elseif" else and if will both expect to be ended with "end" somewhere, remove the space and it should be fine. Link to comment
Dzakub Posted November 10, 2009 Author Share Posted November 10, 2009 I deleted and it still doesn't spawn vehicle, but switching vehicle works Any ideas? Please Help! Link to comment
50p Posted November 10, 2009 Share Posted November 10, 2009 I deleted and it still doesn't spawn vehicle, but switching vehicle works Any ideas? Please Help! What did you delete? Have you debugged it? Debugging will help you find and fix your problems. Link to comment
Wojak Posted November 10, 2009 Share Posted November 10, 2009 I deleted and it still doesn't spawn vehicle, but switching vehicle works Any ideas? Please Help! you missing '=' at line 8 local px, py, pz = getElementPosition(thePlayer) What did you delete? Have you debugged it? Debugging will help you find and fix your problems. he deleted a space But i agre: debugger is you friend Link to comment
Dzakub Posted November 11, 2009 Author Share Posted November 11, 2009 Thx! Next time i will look to Debugger before I will write new topic 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