WoW:API UnitCanCooperate: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
({{wowapi}})
No edit summary
Line 16: Line 16:
: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, false otherwise
6/7/07 returns nil otherwise - Jaycyn


----
----

Revision as of 17:12, 7 June 2007

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, false otherwise

6/7/07 returns nil otherwise - Jaycyn


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.