Jump to content

What is wrong here?


Dzakub

Recommended Posts

Posted

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
)

Posted
I deleted and it still doesn't spawn vehicle, but switching vehicle works :mrgreen:

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 :P But i agre: debugger is you friend ;)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...