Jump to content
Sign in to follow this  
craptakular

if statement error missing ; maybe?

Recommended Posts

I have the code below, but it errors with:

else if _el>
 Error Missing ;
File C:\...missions\spawnshuffle_test.utes\shufflespawn.sqf, line 11
Error in expression <lement = _result select 0;

if _element = "0" {

hint _element;

};

else if _el>
 Error position: <= "0" {

hint _element;

};

I just can't see it, can anyone point it out? Yes I am dumb but I can't get it to work.

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: : Craptakular
//////////////////////////////////////////////////////////////////


_result = [["1","2","3","4","5"]] call CBA_fnc_shuffle;

_element = _result select 0;

if _element = "0" {

hint _element;

};

else if _element = "1" {

hint _element;

};		


else if _element = "2" {

hint _element;

};


else if _element = "3" {

hint _element;

};


else if _element = "4" {

hint _element;

};


else if _element = "5" {

hint _element;

};

Share this post


Link to post
Share on other sites

Why are you using if and else there buddy?

Im guessing you just want to hint the returned value?

If so.. Then

_result = [["1","2","3","4","5"]] call CBA_fnc_shuffle;

_element = _result select 0;


hint format ["%1",  _element ];

Format is a fantastic command, can be used in many different ways...

For example..

Hint format ["%1", name player];

Would return the players name..

this addEventHandler ["killed", "hint format['%1 was killed by %2 with a %3',this name,player name,current weapon player]"];

Using an the killed EVH you can hint who killed who etc...

Check the wiki out..

Lots of great info there...

Edited by marker

Share this post


Link to post
Share on other sites
Why are you using if and else there buddy?

Im guessing you just want to hint the returned value?

If so.. Then

_result = [["1","2","3","4","5"]] call CBA_fnc_shuffle;

_element = _result select 0;


hint format ["%1",  _element ];

Format is a fantastic command, can be used in many different ways...

For example..

Hint format ["%1", name player];

Would return the players name..

this addEventHandler ["killed", "hint format['%1 was killed by %2 with a %3',this name,player name,current weapon player]"];

Using an the killed EVH you can hint who killed who etc...

Check the wiki out..

Lots of great info there...

You are the same marker from ocuk?

You seemed to have missed the issue, the hint lines are just place holders to test if I can get the statement to work. Anyway I fixed it, I have a semi-colon before the else clause and that was the issue.

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: : Craptakular
//////////////////////////////////////////////////////////////////


_result = [[1,2,3,4,5]] call CBA_fnc_shuffle;

_element = _result select 0;

if (_element == 1) then {

hint "The number is 1!";

}

else {

hint "The number is not 1!";

};	

Now works

Share this post


Link to post
Share on other sites

I am mate..

Just looked at the code to see what its function was, didn't realise it was a placeholder...

Cheers, and glad you have it working

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  

×