public static function cmdPay(Player $player, $numparams, $params) { if ($target = Core::FindPlayer($player, $params[1])) { if ($player->Position()->DistanceTo($target->Position()) > 5) { $player->Send(COLOR_TOO_FAR, '[ERROR] Given player is too far'); return COMMAND_BREAK; } $amount = (int) $params[2]; if ($amount > 100000) { $player->Send(COLOR_PAYMENT_TOO_HIGH, '[ERROR] You can pay a max of 100,000$'); return COMMAND_BREAK; } if (Players::CheckPayment($player, $amount)) { $money = Core::FixIntegerDots($amount); $player->GiveMoney(-$amount); $player->Send(COLOR_YOU_PAY, "* You have given {$money}\$ to {$target->name}"); $target->GiveMoney($amount); $target->Send(COLOR_GET_PAID, "* {$player->name} has given you {$money}\$"); Messages::SendNear($player, COLOR_ACTION, "{$player->name} takes some money and gives it to {$target->name}"); } } return COMMAND_BREAK; }
public static function cmdFdeposit(Player $player, $numparams, $params) { if ($player->location->ID() == LSBank::$id && ($faction = $player->GetFaction()) && $faction->AllowedTo($player, MEMBER_ALLOWBANK) && LSBank::AllowPlayer($player) && LSBank::AllowFaction($player, $faction)) { $amount = (int) $params[1]; if (Players::CheckPayment($player, $amount)) { $faction->GiveBank($amount); $player->GiveMoney(-$amount); $bank = Core::FixIntegerDots($faction->GetBank()); $amount = Core::FixIntegerDots($amount); $faction->Send(COLOR_BANK_DEPOSIT, "[FACTION BANK] {$player->name} deposited {$amount}\$ in the faction account. The new balance is {$bank}\$", MEMBER_ALLOWBANK); } } return COMMAND_OK; }