Jump to content
Sign in to follow this  
craptakular

comparison operators woes

Recommended Posts

I am having some difficulty with comparison operators. I have looked here for the operators here.

but am struggling to get the if statement to work, what I want it to consider is:

if _west is between 1 and 10 (inclusive) then execute code, else do some other code. Can anyone help me?

This code below works, it looks to see if there is 1 player, but this is to simplistic, ultimately I want to add in a couple of else if statements to consider when _west is between 11 and 20 (inclusive) and else if _west is between 21 and 30 (inclusive), but I am building uo the script, so need to get it working on the basics first.

//////////////////////////////////////////////////////////////////
// Spawn a different unit based on total human players on side west.
// Created by: : Craptakular
//////////////////////////////////////////////////////////////////

if (!isServer) exitwith {};

_west = playersNumber west;

if (_west == 1) then { 

hint "1 player.";
_tank2 = createGroup East;
[(getMarkerPos "spawnpoint4"), 70, "T34_TK_EP1", _tank2] call BIS_fnc_spawnVehicle;

} 

else { 

hint "More than 1 player.";
_TakGroup3 = [(getMarkerPos "spawnpoint1"), EAST, (ConfigFIle >> "CfgGroups" >> "EAST" >>"BIS_TK" >> "Infantry" >> "TK_InfantrySquad")] call BIS_fnc_spawnGroup;

};



Share this post


Link to post
Share on other sites
if (_west >= 1 && _west <= 10) then
{
   // 1-10
}
else
{
   if (_west > 10 && _west <= 20) then
   {
       // 11-20
   }
   else
   {
       if (_west > 20 && _west <= 30) then
       {
           // 21-30
       }
       else
       {
           // Over 30
       };
   };
};

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  

×