Jump to content

Script error, expected near 'local'


Recommended Posts

Posted (edited)

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

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 )

Posted

what your reading there is a continuation of the comment above it. your "normal" line is its own line, delete it and problem solved

Posted

the local is on the following line, and it sees that as the error instead of the line above.

If you learn to interpret the errors (and test when someone tells you the answer) it would save a lot of time.

Posted
the local is on the following line, and it sees that as the error instead of the line above.

If you learn to interpret the errors (and test when someone tells you the answer) it would save a lot of time.

Yes, but

'=' expected near 'local'

Local have to be an = ?

Posted

Oh god you don't bother to try, or even to read... Now do you...

What do we need to do to make you try to get your brains working... Do we need to put it under high voltage? :roll:

Posted
Oh god you don't bother to try, or even to read... Now do you...

What do we need to do to make you try to get your brains working... Do we need to put it under high voltage? :roll:

At least one megavolt, please.

Posted

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 '==' 
  

Posted

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

Posted
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 :$

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

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

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