WoW:API UnitCanCooperate: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
mNo edit summary
m (Move page script moved page API UnitCanCooperate to API UnitCanCooperate without leaving a redirect)
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<center>'''UnitCanCooperate''' ''-Documentation by [[user:Meog|Meog]]-''</center>
{{wowapi}}


Returns true if the first unit can cooperate with the second, false otherwise.
Returns true if the first unit can cooperate with the second, false otherwise.
Line 15: Line 15:


:Boolean cancooperate
:Boolean cancooperate
:;cancooperate : true if the first unit can cooperate with the second, false otherwise
:;cancooperate : true if the first unit can cooperate with the second, nil otherwise


----
----
Line 32: Line 32:


: Returns true if the first unit can cooperate with the second, false otherwise.
: Returns true if the first unit can cooperate with the second, false otherwise.
----
{{Template:WoW API}}
[[Category:API Functions|UnitCanCooperate]]
[[Category:API Unit Functions|UnitCanCooperate]]

Latest revision as of 04:47, 15 August 2023

WoW API < UnitCanCooperate

Returns true if the first unit can cooperate with the second, false otherwise.

UnitCanCooperate(unit1, unit2);

Arguments
String unit1, String unit2
unit1, unit2
name of the units as string, also valid are "player" for the current player, "target" for the current target

Returns
Boolean cancooperate
cancooperate
true if the first unit can cooperate with the second, nil otherwise

Example
if ( UnitCanCooperate("player", "target") ) then
   AddFriend(UnitName("target"));
else
   StaticPopup_Show("ADD_FRIEND");
end
Result
Adds the target to the friends list, if the target can be added to the friends list. Shows the add friend dialog otherwise.

Description
Returns true if the first unit can cooperate with the second, false otherwise.