Author Topic: Getting Syntax errors :O  (Read 602 times)

For some reason it keeps on getting syntax errors

Code: [Select]
package m4
{
function serverCmdlight(%client)
{
if(!isObject(%client.player) || !isObject(%client.player.getMountedImage(0)$=nameToID(M4Image))
{
return;
}
%player = %client.Player;
%m4 = %client.player.getMountedImage(0);

if(%m4 == m4Image.getID())
{
%m4.silence = !%m4.silence;

if(%m4.silence)
{

               %player.mountImage(M4silencedImage,0);


return;
}


               %player.mountImage(M4Image,0);

return;
}
if(%m4 == m4silencedImage.getID())
{
%m4.none = !%m4.none;

if(%m4.none)
{
// %m4.unhideNode(silence);
               %player.mountImage(M4Image,0);


return;
}

//%m4.hideNode(silence);
               %player.mountImage(M4Image,0);

return;
}

parent::serverCmdlight(%client);
}
};

Console:
Code: [Select]
>>> Some error context, with ## on sides of error halt:
^^if(!isObject(%client.player) || !isObject(%client.player.getMountedImage(0)$=nameToID(M4Image))

^^{##
##
^^^return;

^^}

^^^^%player = %client.Player;

^^%m4 = %client.player.getMountedImage(0);
>>> Error report complete.

Executing Add-Ons/Weapon_CSS/Weapon_m4.cs.
Add-Ons/Weapon_CSS/Weapon_m4.cs Line: 629 - Syntax error.
>>> Some error context, with ## on sides of error halt:
^^if(!isObject(%client.player) || !isObject(%client.player.getMountedImage(0)$=nameToID(M4Image))

^^{##
##
^^^return;

^^}

^^^^%player = %client.Player;

^^%m4 = %client.player.getMountedImage(0);
>>> Error report complete.

Code: [Select]
if(!isObject(%client.player) || !isObject(%client.player.getMountedImage(0)$=nameToID(M4Image)))
{
return;
}
You were missing a ), put that in

God, learn how to solve problems yourself. Don't find one error and instantly make a topic here about it.

I thought that's why theres a coding help section.

If I posted every time I had an error, there would be at least 20 new topics in the help section by me in the past three days.  Learn to problem solve.

I think a problem solving topic should be made...


Code: [Select]
if(!isObject(%client.player) || !isObject(%client.player.getMountedImage(0)$=nameToID(M4Image)))
{
return;
}

On another note, the following line:

!isObject(%client.player.getMountedImage(0)$=nameToID(M4Image))

Makes no logical sense at all, you're testing if the result of a comparison is not an object.

Yeah, I think Ephi gots that right...
If this works, then you are actually testing if object 1 or 0 exists.