Is online: Difference between revisions
Jump to navigation
Jump to search
imported>Bale new page |
imported>Mrfred No edit summary |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
FunctionPage| | FunctionPage| | ||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 12: | Line 11: | ||
return_type={{#var:return_type}}| | return_type={{#var:return_type}}| | ||
return_also={{#var:return_also}}| | return_also={{#var:return_also}}| | ||
parameter1={{Param|string| | parameter1={{Param|string|player}}| | ||
p1desc={{Pspan| | p1desc={{Pspan|player}} is the name of a player| | ||
}}| | }}| | ||
function_description=Checks to see if a given | function2={{Function| | ||
name={{#var:name}}| | |||
aggregate={{#var:aggregate}}| | |||
return_type={{#var:return_type}}| | |||
return_also={{#var:return_also}}| | |||
parameter1={{Param|int|player_id}}| | |||
p1desc={{Pspan|player_id}} is the id of a player| | |||
}}| | |||
function_description=Checks to see if a given {{pspan|player}} is currently online, returning true if they are, false otherwise. Works on any player, not just those on your friends list and in your clan.| | |||
code1={{CodeSample| | code1={{CodeSample| | ||
Line 39: | Line 47: | ||
</syntaxhighlight>}}| | </syntaxhighlight>}}| | ||
special=Note that this function returns false if {{pspan|player}} does not exist. | |||
}} | |||
[[Category:Miscellaneous Functions]] |
Latest revision as of 03:16, 14 January 2014
Function Syntax
boolean is_online(string player )
- player is the name of a player
boolean is_online(int player_id )
- player_id is the id of a player
Checks to see if a given player is currently online, returning true if they are, false otherwise. Works on any player, not just those on your friends list and in your clan.
Code Sample
Try to get Sonata of Sneakiness from an online buffbots, skipping those that are not online.
int bots_tried;
if(is_online("IocaineBot")) {
cli_execute("csend 18 meat to IocaineBot");
bots_tried = bots_tried + 1;
}
if(is_online("KolaBuff")) {
cli_execute("csend 23 meat to KolaBuff");
bots_tried = bots_tried + 1;
}
if(is_online("zonkttc")) {
cli_execute("csend 17 meat to zonkttc");
bots_tried = bots_tried + 1;
}
print("Asked "+ bots_tried +" buffbots for Sonata of Sneakiness.");
Special
Note that this function returns false if player does not exist.