WoW:API CanSummonFriend: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (stub for more context)
m (Move page script moved page API CanSummonFriend to API CanSummonFriend without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{stub/API}}
{{wowapi}} __NOTOC__
{{wowapi}} __NOTOC__
 
Returns whether you can RaF summon a particular unit.
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
  summonable = CanSummonFriend("unit")
  CanSummonFriend("unit")


== Arguments ==
== Arguments ==
<!-- List each argument, together with its type -->
;unit : String ([[UnitId]]) - player to check whether you can summon.
:("unit")
 
:;unit : [[UnitId]] or a name, returns true if you can summon the target or nil if not
 


== Returns ==
== Returns ==
<!-- List each return value, together with its type -->
;summonable : Flag - 1 if you can summon the unit using RaF, nil otherwise.
 
Nothing
 


== Example ==
== Example ==
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
The snippet below checks whether you can summon the target, and, if so, whispers and summons her to you.
  local t = "Zuotheshaman";  
  local t = "target";  
  if CanSummonFriend(t) then  
  if CanSummonFriend(t) then  
   SendChatMessage("I am summoning you!","WHISPER",nil,t)  
   SendChatMessage("I am summoning you!","WHISPER",nil,t)  
   SummonFriend(t)  
   SummonFriend(t)  
  end  
  end
 
 
<big>'''Result'''</big>
<!-- If it helps, include example results here, though they are not required. You're allowed to cheat liberally since WoW isn't a command line language. -->
 
If you can summon the target, you whisper and summon him/her to you. Check out [[API_SummonFriend|SummonFriend]]() for details about that function.

Latest revision as of 04:45, 15 August 2023

WoW API < CanSummonFriend

Returns whether you can RaF summon a particular unit.

summonable = CanSummonFriend("unit")

Arguments[edit]

unit
String (UnitId) - player to check whether you can summon.

Returns[edit]

summonable
Flag - 1 if you can summon the unit using RaF, nil otherwise.

Example[edit]

The snippet below checks whether you can summon the target, and, if so, whispers and summons her to you.

local t = "target"; 
if CanSummonFriend(t) then 
  SendChatMessage("I am summoning you!","WHISPER",nil,t) 
  SummonFriend(t) 
end