Dzakub Posted November 10, 2009 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 )
Dark Dragon Posted November 10, 2009 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.
Dzakub Posted November 10, 2009 Author Posted November 10, 2009 I deleted and it still doesn't spawn vehicle, but switching vehicle works Any ideas? Please Help!
50p Posted November 10, 2009 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.
Wojak Posted November 10, 2009 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
Dzakub Posted November 11, 2009 Author Posted November 11, 2009 Thx! Next time i will look to Debugger before I will write new topic
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