Jump to content
Sign in to follow this  
Maciver

Noob scripting help

Recommended Posts

if ( player side == west ) then
{
[player] joinSilent alpha;
}
else
{
[player] joinSilent bravo;
};

Been trying to get this to work. It seems so simple, and I've accomplished what seems like far more complicated things. However, I just cant get this to work! lol

I've tried several different ways, and structures of the if variable, anything i could find searching or with wiki. Even declaring variables before the if statement and using those. No matter what I've done, the player always joins bravo. The script is activated from an action menu item. Rest of the script is working cept this bit.

Any help would be much appreciated!

Share this post


Link to post
Share on other sites

He still joins bravo, sadly :(

Im just to the point of going in circles with trial and error now lol.

Share this post


Link to post
Share on other sites

Where are you running that? In init.sqf?

If so, try waiting for player to init:

[] spawn {
 waituntil {!isnull player};
 if ( side side == west ) then {
   [player] joinSilent alpha;
 } else {
   [player] joinSilent bravo;
 };
};

Share this post


Link to post
Share on other sites

The script is activated from an item with add action on it. I tried adding that code anyway, same thing happens.

It's a USMC soldier, who is obviously already west. Something is wrong with the declaring the unit as west.

Whats trying to happen is if blufor uses this action on the item, they join alpha. If Independant uses the action they join bravo. The squads exist already, so not sure whats going on.

Share this post


Link to post
Share on other sites

Well under some conditions the player side may will switch.

So to make sure 100% you could get the side number from the config.

0 = EAST

1 = WEST

2 = GUER

3 = CIV

_side = getNumber (configFile >> "CfgVehicles" >> (typeOf _player) >> "side");

if (_side == 1) then // This means if side player == WEST
{
[player] joinSilent alpha;
}
else
{
[player] joinSilent bravo;
};

Share this post


Link to post
Share on other sites

Still no go. Think I may have to pick another route to the end of this script lol.

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  

×