Jump to content

Script error, expected near 'local'


Recommended Posts

Just had made 1 script (yes, at my own xD) but there is a error in it:

My script:

    function createstartvehicles ( playerSource, source, commandName, car, x, y, z ) -- the function allows specification of your car, and the position 
      fadeCamera ( source, false, 1.0, 255, 0, 0 )         -- fade the player's camera to red over a period of 1 second 
      setTimer ( fadeCamera, 500, 1, source, true, 0.5 )   -- don't let it go to opaque red, interrupt it after half a second and fade back to normal 
    normal 
    local racevehicle = createVehicle ( 420, x, y, z )                   -- create a vehicle at the position specified by the startrace command 
    warpPlayerIntoVehicle ( playerSource, racevehicle )                  -- warp them straight into the vehicle 

Error:

[21:27:54] SCRIPT ERROR: .../MTA/mods/deathmatch/resources/race/script.lua:40: '=' expected near 'local'

[21:27:54] INFO: Loading script failed: .../MTA/mods/deathmatch/resources/race/script.lua:40: '=' expected near 'local'

What's the problem?

Edited by Guest
Link to comment
...

normal

...

What's this doing there...

http://development.mtasa.com/index.php?title=FadeCamera

function addRednessOnDamage ( )

fadeCamera ( source, false, 1.0, 255, 0, 0 ) -- fade the player's camera to red over a period of 1 second

setTimer ( fadeCamera, 500, 1, source, true, 0.5 ) -- don't let it go to opaque red, interrupt it after half a second and fade back to

normal

end

addEventHandler ( "onPlayerDamage", getRootElement(), addRednessOnDamage )

Link to comment

No, just another error.

Script:

function createstartvehicles ( playerSource, source, commandName, car, x, y, z ) -- the function allows specification of your car, and the position 
      fadeCamera ( source, false, 1.0, 255, 0, 0 )         -- fade the player's camera to red over a period of 1 second 
      setTimer ( fadeCamera, 500, 1, source, true, 0.5 )   
    local racevehicle == createVehicle ( 420, x, y, z )                   -- create a vehicle at the position specified by the startrace command 
    warpPlayerIntoVehicle ( playerSource, racevehicle )                 -- warp them straight into the vehicle 
    setElementPosition ( source, 2002.5007324219, -1445.4700927734, 13.6 ) 
    removePlayerFromVehicle ( source ) 
end 

Then the error:

[09:12:02] SCRIPT ERROR: .../MTA/mods/deathmatch/resources/race/script.lua:39: unexpected symbol near '==' 
[09:12:02] INFO: Loading script failed: .../MTA/mods/deathmatch/resources/race/script.lua:39: unexpected symbol near '==' 
  

Link to comment

Lord's knee, and my eyes...

Seriously, why the hell did you change this...

local racevehicle = createVehicle ( 420, x, y, z ) 

...Into this...

local racevehicle == createVehicle ( 420, x, y, z ) 

First one should have worked perfectly and then you change it in something that doesn't make any sense at all... "==" is only for checking if something is equal to a value, NOT for defining a value... That's what "=" is for...

Link to comment
Lord's knee, and my eyes...

Seriously, why the hell did you change this...

local racevehicle = createVehicle ( 420, x, y, z ) 

...Into this...

local racevehicle == createVehicle ( 420, x, y, z ) 

First one should have worked perfectly and then you change it in something that doesn't make any sense at all... "==" is only for checking if something is equal to a value, NOT for defining a value... That's what "=" is for...

Ah thx, i just had give a try.

Sorry :$

Link to comment
Lord's knee, and my eyes...

Seriously, why the hell did you change this...

local racevehicle = createVehicle ( 420, x, y, z ) 

...Into this...

local racevehicle == createVehicle ( 420, x, y, z ) 

First one should have worked perfectly and then you change it in something that doesn't make any sense at all... "==" is only for checking if something is equal to a value, NOT for defining a value... That's what "=" is for...

Ah thx, i just had give a try.

Sorry :$

You "had to give a try", and when it gave you an error you didn't think of undoing it? Duh. I don't know whether to laugh or facepalm or cry, or any combination. Once again; read the basics. (I suggest everybody not to help this guy until he does.)

Also, thehookerkiller, stop answering questions. You don't know enough, and just end up giving people wrong information.

Link to comment
Lord's knee, and my eyes...

Seriously, why the hell did you change this...

local racevehicle = createVehicle ( 420, x, y, z ) 

...Into this...

local racevehicle == createVehicle ( 420, x, y, z ) 

First one should have worked perfectly and then you change it in something that doesn't make any sense at all... "==" is only for checking if something is equal to a value, NOT for defining a value... That's what "=" is for...

Ok now changed it, but now there is just an error with everything in the script.

Link to comment

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...