本文整理汇总了PHP中Player::GetFaction方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::GetFaction方法的具体用法?PHP Player::GetFaction怎么用?PHP Player::GetFaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player::GetFaction方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnEnter
/**
** Location callbacks
**/
protected function OnEnter(Player $player, $numparams, $params)
{
if ($this->open) {
return LOCATION_ALLOW;
} else {
if ($player->GetFaction() && $player->GetFaction()->ID() == $this->owner->ID()) {
return LOCATION_ALLOW;
}
}
GameTextForPlayer($player->id, '~r~Closed', 2000, 3);
return LOCATION_DISALLOW;
}
示例2: GetNameForPlayer
public function GetNameForPlayer(Player $player)
{
$faction = $player->GetFaction();
if (!$faction || $faction->id != $this->id) {
return $player->account->name;
}
$rank = $player->GetRank();
if ($rank === null || $rank > 1) {
return $player->account->name;
}
$name = $player->account->name;
$p = strpos($name, '_');
if ($p === FALSE) {
return $name;
}
return substr($name, 0, $p) . '_Corleone';
}
示例3: Allowed
public function Allowed(Player $player)
{
if ($this->account != null) {
if ($player->account && $player->account->ID() == $this->account) {
return true;
}
return false;
} else {
if ($this->faction != null) {
$faction = $player->GetFaction();
if ($faction != null && $this->faction == $faction->ID()) {
return true;
}
return false;
}
}
return false;
}
示例4: GetNameForPlayer
public function GetNameForPlayer(Player $player)
{
$faction = $player->GetFaction();
if (!$faction || $faction->id != $this->id) {
return $player->account->name;
}
$name = $player->account->name;
$p = strpos($name, '_');
if ($p === FALSE) {
return $name;
}
$initial = $name[0];
$badge = crc32($name) % 99 + 1;
if ($badge < 0) {
$badge = -$badge;
}
return $initial . '_' . substr($name, $p + 1) . '_' . sprintf('%02d', $badge);
}
示例5: cmdClose
public static function cmdClose(Player $player, $numparams, $params)
{
if ($faction = $player->GetFaction()) {
}
return COMMAND_OK;
}
示例6: cmdStats
/**
** Stats must show:
** Name(ID)[], CurrentName[] (for people who changed their name), Money[], Bank[], Level[], Deaths[], AcceptedDeaths[], SavedDeaths[],
** SpawnHealth[default 40], Level[], Experience[XX/YY], Phone[], Job[],
** Faction[], Rank[], Wife/Husband[], Sex[], Age[].
**/
public static function cmdStats(Player $player, $numparams, $params)
{
$money = Core::FixIntegerDots($player->GetMoney());
$bank = Core::FixIntegerDots($player->GetBank());
$level = $player->GetLevel();
$exp = $player->GetExperience();
$married = $player->GetMarried();
$hspawn = 100 - $player->GetInjures();
$age = $player->GetAge();
$faction = $player->GetFaction(false);
$hunger = (int) ($player->GetHunger() / 10);
$strength = $player->GetStrength();
/* Find their marriage */
if ($married != null) {
if ($married['sex'] == 'M') {
$wordmarried = 'Husband';
} else {
$wordmarried = 'Wife';
}
$marryname = $married['name'];
} else {
if ($player->GetSex() == 'M') {
$wordmarried = 'Wife';
} else {
$wordmarried = 'Husband';
}
$marryname = '';
}
/* Complete the sex word */
if ($player->GetSex() == 'M') {
$sex = 'Male';
} else {
$sex = 'Female';
}
/* Find their faction name */
if ($faction == null) {
$facname = 'Civilian';
$rank = '';
} else {
$facname = $faction->GetName();
$rank = $faction->GetRankName($player->GetRank());
}
/* TODO: Complete the stats when they are being coded */
$player->Send(COLOR_STATS_DECORATION, '-=-=-=-=-=-=-=-=-=-=-=-=-= Player stats -=-=-=-=-=-=-=-=-=-=-=-=-=-');
$player->Send(COLOR_STATS, "{$player->name}({$player->id}) - Money[{$money}\$] - Bank[{$bank}\$] - Phone[] - PremiumLevel[TODO]");
$player->Send(COLOR_STATS, "Level[{$level}] - Experience[{$exp}] - Deaths[TODO]: Accepted[TODO], Saved[TODO]");
$player->Send(COLOR_STATS, "Health[{$hspawn} / 100] - Hunger[{$hunger} / " . (int) (MAX_HUNGER_POINTS / 10) . "] - " . "Strength[{$strength} / " . MAX_STRENGTH_POINTS . "] - Age[{$age}] - Sex[{$sex}]");
$player->Send(COLOR_STATS, "{$wordmarried}[{$marryname}] - Faction[{$facname}] - Rank[{$rank}] - Job[TODO]");
$player->Send(COLOR_STATS_DECORATION, '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-');
return COMMAND_BREAK;
}
示例7: cmdFtransfer
public static function cmdFtransfer(Player $player, $numparams, $params)
{
if ($player->location->ID() == LSBank::$id && ($faction = $player->GetFaction()) && $faction->AllowedTo($player, MEMBER_ALLOWBANK) && LSBank::AllowFaction($player, $faction)) {
$amount = (int) $params[1];
$target_name = implode(' ', array_slice($params, 2));
$target = Factions::FindByName($target_name);
if ($target && Factions::CheckPaybank($player, $faction, $amount, $target)) {
$faction->GiveBank(-$amount);
$target->GiveBank($amount);
$bank1 = $faction->GetBank();
$bank2 = $target->GetBank();
$amount = Core::FixIntegerDots($amount);
$faction->Send(COLOR_BANK_TRANSFER, "[FACTION BANK] {$player->name} transfered {$amount}\$ to {$target->GetName()} faction", MEMBER_ALLOWBANK);
$target->Send(COLOR_BANK_TRANSFER, "[FACTION BANK] {$faction->GetName()} faction transfered {$amount}\$ to your faction", MEMBER_ALLOWBANK);
}
}
return COMMAND_OK;
}