playerSide: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[Category:[ _]?Scripting[ _]Commands[ _]OFP[ _]Elite *(\|.*)?\]\]" to "{{GameCategory|ofpe|Scripting Commands}}")
m (Text replacement - "\{\{Feature *\| *Informative *\| ([^↵]+) *\}\}" to "{{Feature|informative|$1}}")
 
(27 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma1 |Game name=
|game1= arma1
|version1= 1.00


|1.00|Game version=
|game2= arma2
|version2= 1.00


|gr1= Sides |GROUP1=
|game3= arma2oa
____________________________________________________________________________________________
|version3= 1.50


| Returns the player's [[Side|side]]. This is valid even when the player controlled person is dead (a difference from [[side]] [[player]]).
|game4= tkoh
{{Informative | [[playerSide]] will not change automatically if [[player]] [[join]]s a [[group]] on different [[side]]. However, [[selectPlayer]] command can and does change [[playerSide]] - see '''[[#Examples|Example 3]]''' for information.}} |DESCRIPTION=
|version4= 1.00
____________________________________________________________________________________________


| '''playerSide''' |SYNTAX=
|game5= arma3
|version5= 0.50


| [[Side]] |RETURNVALUE=
|gr1= Sides


|x1=  
|descr= Returns the player's [[Side|side]]. This is valid even when the player controlled person is dead (a difference from [[side]] [[player]]).
<code>[[if]] ([[side]] man1 == '''playerSide''') [[then]] {
{{Feature|informative|[[playerSide]] will not change automatically if [[player]] [[join]]s a [[group]] on different [[side]]. However, [[selectPlayer]] command can and does change [[playerSide]] - see {{Link|#Example 3}} for information.}}
    [[hint]] "man1 is on your side!";
};</code>|EXAMPLE1=


|x2= <code>[[switch]] ([[playerSide]]) do {
|s1= [[playerSide]]
    [[case]] [[west]]: {
 
        [[hint]] "You are BLUFOR";
|r1= [[Side]]
    };
 
    [[case]] [[east]]: {
|x1= <sqf>
        [[hint]] "You are OPFOR";
if (side man1 == playerSide) then
    };
{
};</code>|EXAMPLE2=
hint "man1 is on your side!";
};
</sqf>
 
|x2= <sqf>
switch (playerSide) do
{
case west: { hint "You are BLUFOR"; };
case east: { hint "You are OPFOR"; };
};
</sqf>


|x3= the following code will change the side of the player including [[playerSide]]:
|x3= the following code will change the side of the player including [[playerSide]]:
<code>[[private]] _player {{=}} [[player]];  
<sqf>
[<nowiki/>[[player]]] [[join]] [[createGroup]] [[east]];  
private _player = player;
[[selectNoPlayer]];  
[player] join createGroup east;
[[selectPlayer]] _player;
selectNoPlayer;
[[hint]] [[str]] [[playerSide]]; {{cc|EAST}}</code> |EXAMPLE3=
selectPlayer _player;
____________________________________________________________________________________________
hint str playerSide; // EAST
</sqf>


| [[Side]], [[side]], [[west]], [[east]], [[resistance]], [[civilian]], [[sideLogic]], [[sideFriendly]], [[sideEnemy]], [[sideUnknown]], [[sideEmpty]], [[sideAmbientLife]], [[Side relations]] |SEEALSO=
|seealso= [[Side]] [[side]] [[west]] [[east]] [[resistance]] [[civilian]] [[sideLogic]] [[sideFriendly]] [[sideEnemy]] [[sideUnknown]] [[sideEmpty]] [[sideAmbientLife]] [[Side Relations]]
}}
}}


<h3 style="display:none">Notes</h3>
{{Note
<dl class="command_description">
|user= Dr_Eyeball
<!-- Note Section BEGIN -->
|timestamp= 20080127075200
 
|text= [[playerSide]] defaults to [[west]] for JIP players early on during initialization regardless of their side.<br>
<dd class="notedate">Posted on 27 Jan, 2008
<dt class="note">[[User:Dr_Eyeball|Dr_Eyeball]]<dd class="note">
[[playerSide]] defaults to [[west]] for JIP players early on during initialization regardless of their side.<br>
So if you are a JIP player on another side (like [[east]]), you will need to cater for this for any early initializations.
So if you are a JIP player on another side (like [[east]]), you will need to cater for this for any early initializations.
}}


<dd class="notedate">Posted on 13 Oct, 2008
{{Note
<dt class="note">[[User:Dr_Eyeball|Dr_Eyeball]]<dd class="note">
|user= Dr_Eyeball
[[playerSide]] also shows your starting side, even if your [[side]] changes to [[enemy]] due to a bad [[rating]]. In that case, playerSide != side player.
|timestamp= 20081013083000
 
|text= [[playerSide]] also shows your starting side, even if your [[side]] changes to [[enemy]] due to a bad [[rating]]. In that case, playerSide != side player.
<!-- Note Section END -->
}}
</dl>
 
<h3 style="display:none">Bottom Section</h3>
{{GameCategory|ofpe|Scripting Commands}}
{{GameCategory|arma2|Scripting Commands}}
{{GameCategory|arma3|Scripting Commands}}
{{GameCategory|tkoh|Scripting Commands}}

Latest revision as of 18:11, 15 March 2024

Hover & click on the images for description

Description

Description:
Returns the player's side. This is valid even when the player controlled person is dead (a difference from side player).
playerSide will not change automatically if player joins a group on different side. However, selectPlayer command can and does change playerSide - see Example 3 for information.
Groups:
Sides

Syntax

Syntax:
playerSide
Return Value:
Side

Examples

Example 1:
if (side man1 == playerSide) then { hint "man1 is on your side!"; };
Example 2:
switch (playerSide) do { case west: { hint "You are BLUFOR"; }; case east: { hint "You are OPFOR"; }; };
Example 3:
the following code will change the side of the player including playerSide:
private _player = player; [player] join createGroup east; selectNoPlayer; selectPlayer _player; hint str playerSide; // EAST

Additional Information

See also:
Side side west east resistance civilian sideLogic sideFriendly sideEnemy sideUnknown sideEmpty sideAmbientLife Side Relations

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Dr_Eyeball - c
Posted on Jan 27, 2008 - 07:52 (UTC)
playerSide defaults to west for JIP players early on during initialization regardless of their side.
So if you are a JIP player on another side (like east), you will need to cater for this for any early initializations.
Dr_Eyeball - c
Posted on Oct 13, 2008 - 08:30 (UTC)
playerSide also shows your starting side, even if your side changes to enemy due to a bad rating. In that case, playerSide != side player.