BNRG fnc getOwnerFromClient: Difference between revisions

From Benargee's Wiki
Jump to navigation Jump to search
No edit summary
(formatting)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[category:Arma 3 Functions]]
=BNRG_fnc_getOwnerFromClient=
Allows a client to get accurate owner ids


BNRG_GetOwnerFromClient = {<br>
=Use=
<br>
==Syntax==
_requestedObject = [_this, 0, player,[player]] call BIS_fnc_param;<br>
[queriedObject,queryRecipiantObject] spawn '''BNRG_fnc_getOwnerFromClient'''
_requestor = [_this, 1, player,[player]] call BIS_fnc_param;<br>
queriedObject (optional) - Object - <br>
call Compile format ["BNRG_fnc_ClientGetOwner_ID_%1 = nil",getplayeruid _requestor];<br>
queryRecipiantObject (optional) - Object -
BNRG_GetOwnerFromClient_RETURN = nil;<br>
==Examples==
<br>
[] spawn '''BNRG_fnc_getOwnerFromClient'''
[[[_requestedObject,_requestor], {<br>
if (isServer) then {<br>
_BNRG_fnc_SendOwnerToClient = compile format['<br>
BNRG_fnc_ClientGetOwner_ID_%1 = owner (_this select 0);<br>
_BNRG_fnc_ClientGetOwner_ID_Requestor = owner (_this select 1);<br>
_BNRG_fnc_ClientGetOwner_ID_Requestor publicVariableClient "BNRG_fnc_ClientGetOwner_ID_%1";<br>
BNRG_fnc_ClientGetOwner_ID_%1 = nil;<br>
',getplayeruid (_this select 0)];<br>
<br>
[_this select 0, _this select 1] call _BNRG_fnc_SendOwnerToClient;<br>
};<br>
}], "BIS_fnc_spawn", true, false, false] call BIS_fnc_MP;<br>
<br>
BNRG_GetOwnerFromClient_RETURN = call Compile format ["waitUntil {!isNil 'BNRG_fnc_ClientGetOwner_ID_%1'}; BNRG_fnc_ClientGetOwner_ID_%1;",getplayeruid _requestor];<br>
waitUntil {!isNil 'BNRG_GetOwnerFromClient_RETURN'}<br>
call Compile format ["BNRG_fnc_ClientGetOwner_ID_%1 = nil",getplayeruid _requestor];<br>
};<br>


<!---Raw Code --->
[_obj] spawn '''BNRG_fnc_getOwnerFromClient'''
<!---


[_obj,otherPlayer] spawn '''BNRG_fnc_getOwnerFromClient'''


BNRG_GetOwnerFromClient = {
=Code=


_requestedObject = [_this, 0, player,[player]] call BIS_fnc_param;
'''BNRG_GetOwnerFromClient''' = {
_requestor = [_this, 1, player,[player]] call BIS_fnc_param;
call Compile format ["BNRG_fnc_ClientGetOwner_ID_%1 = nil",getplayeruid _requestor];
_requestedObject = [_this, 0, player,[player]] call BIS_fnc_param;
BNRG_GetOwnerFromClient_RETURN = nil;
_requestor = [_this, 1, player,[player]] call BIS_fnc_param;
call Compile format ["BNRG_fnc_ClientGetOwner_ID_%1 = nil",getplayeruid _requestor];
[[[_requestedObject,_requestor], {
BNRG_GetOwnerFromClient_RETURN = nil;
if (isServer) then {
_BNRG_fnc_SendOwnerToClient = compile format['
[[[_requestedObject,_requestor], {
BNRG_fnc_ClientGetOwner_ID_%1 = owner (_this select 0);
if (isServer) then {
_BNRG_fnc_ClientGetOwner_ID_Requestor = owner (_this select 1);
_BNRG_fnc_SendOwnerToClient = compile format['
_BNRG_fnc_ClientGetOwner_ID_Requestor publicVariableClient "BNRG_fnc_ClientGetOwner_ID_%1";
BNRG_fnc_ClientGetOwner_ID_%1 = owner (_this select 0);
BNRG_fnc_ClientGetOwner_ID_%1 = nil;
_BNRG_fnc_ClientGetOwner_ID_Requestor = owner (_this select 1);
',getplayeruid (_this select 0)];
_BNRG_fnc_ClientGetOwner_ID_Requestor publicVariableClient "BNRG_fnc_ClientGetOwner_ID_%1";
BNRG_fnc_ClientGetOwner_ID_%1 = nil;
[_this select 0, _this select 1] call _BNRG_fnc_SendOwnerToClient;
',getplayeruid (_this select 0)];
};
}], "BIS_fnc_spawn", true, false, false] call BIS_fnc_MP;
[_this select 0, _this select 1] call _BNRG_fnc_SendOwnerToClient;
};
}], "BIS_fnc_spawn", true, false, false] call BIS_fnc_MP;
BNRG_GetOwnerFromClient_RETURN = call Compile format ["waitUntil {!isNil 'BNRG_fnc_ClientGetOwner_ID_%1'}; BNRG_fnc_ClientGetOwner_ID_%1;",getplayeruid _requestor];
waitUntil {!isNil 'BNRG_GetOwnerFromClient_RETURN'}
call Compile format ["BNRG_fnc_ClientGetOwner_ID_%1 = nil",getplayeruid _requestor];
};


BNRG_GetOwnerFromClient_RETURN = call Compile format ["waitUntil {!isNil 'BNRG_fnc_ClientGetOwner_ID_%1'}; BNRG_fnc_ClientGetOwner_ID_%1;",getplayeruid _requestor];
waitUntil {!isNil 'BNRG_GetOwnerFromClient_RETURN'}
call Compile format ["BNRG_fnc_ClientGetOwner_ID_%1 = nil",getplayeruid _requestor];
};
--->


=Return=
=Return=
Use BNRG_GetOwnerFromClient_RETURN to get return value NUMBER
Use '''BNRG_GetOwnerFromClient_RETURN''' to get return value NUMBER

Latest revision as of 20:15, 27 March 2015

BNRG_fnc_getOwnerFromClient

Allows a client to get accurate owner ids

Use

Syntax

[queriedObject,queryRecipiantObject] spawn BNRG_fnc_getOwnerFromClient

queriedObject (optional) - Object -
queryRecipiantObject (optional) - Object -

Examples

[] spawn BNRG_fnc_getOwnerFromClient
[_obj] spawn BNRG_fnc_getOwnerFromClient
[_obj,otherPlayer] spawn BNRG_fnc_getOwnerFromClient

Code

BNRG_GetOwnerFromClient = {

_requestedObject = [_this, 0, player,[player]] call BIS_fnc_param;
_requestor = [_this, 1, player,[player]] call BIS_fnc_param;
call Compile format ["BNRG_fnc_ClientGetOwner_ID_%1 = nil",getplayeruid _requestor];
BNRG_GetOwnerFromClient_RETURN = nil;
	
	[[[_requestedObject,_requestor], {
		if (isServer) then {
			_BNRG_fnc_SendOwnerToClient = compile format['
				BNRG_fnc_ClientGetOwner_ID_%1 = owner (_this select 0);
				_BNRG_fnc_ClientGetOwner_ID_Requestor = owner (_this select 1);
				_BNRG_fnc_ClientGetOwner_ID_Requestor publicVariableClient "BNRG_fnc_ClientGetOwner_ID_%1";
				BNRG_fnc_ClientGetOwner_ID_%1 = nil;
			',getplayeruid (_this select 0)];
			
			[_this select 0, _this select 1] call _BNRG_fnc_SendOwnerToClient;				
	};
}], "BIS_fnc_spawn", true, false, false] call BIS_fnc_MP;

BNRG_GetOwnerFromClient_RETURN = call Compile format ["waitUntil {!isNil 'BNRG_fnc_ClientGetOwner_ID_%1'}; BNRG_fnc_ClientGetOwner_ID_%1;",getplayeruid _requestor];
waitUntil {!isNil 'BNRG_GetOwnerFromClient_RETURN'}
call Compile format ["BNRG_fnc_ClientGetOwner_ID_%1 = nil",getplayeruid _requestor];
};


Return

Use BNRG_GetOwnerFromClient_RETURN to get return value NUMBER