Jump to content
Sign in to follow this  
norbre

Control Structures problem

Recommended Posts

hi all,

I've a big problem.. I've tried to use "switch" and "if" in init.sqs but it causes an error message:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

color="blue";

if (color == "blue") then

{

hint "BLUE";

};

it gives this error message and no hint message:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

'|#|};'

Error Missing {

and int this case:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

switch (color) do

{

case "blue":

{

hint "BLUE COLOR";

};

case "red":

{

hint "RED COLOR";

};

};

it gives the same error message and "RED COLOR" hint message

, but this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

hint color;

gives a "BLUE" hint message.

banghead.gifbanghead.gifbanghead.gifbanghead.gif

i dont understand what is the problem.. plz help me !!! sad_o.gif

Share this post


Link to post
Share on other sites

are you using this in a script? ..in a SQF script?

Those errors looks like you put the mentioned SQF code into an SQS script.

Share this post


Link to post
Share on other sites

oooo thanks pal!

that was the problem.. i used in init.sqs.. but in init.sqf all works good.. notworthy.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×