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 cmdUnlockwindows(Player $player, $numparams, $params) { $vehicle = $player->GetVehicle(); if ($player->IsDriver() && $vehicle != null && $vehicle->HasRollableWindows()) { if ($vehicle->LockedWindows()) { $vehicle->LockWindows(false); Messages::SendNear($player, COLOR_LOCKING_WINDOWS, "{$player->name} has unlocked the vehicle windows"); } } return COMMAND_OK; }
public static function cookItem(Player $player, $item) { if ($player->location instanceof House && isset(Houses::$cookitems[$item])) { $house = $player->location; $room = $house->GetPlayerRoom($player); $cook = Houses::$cookitems[$item]; $fridge = $room->GetFridge(); if ($fridge < $cook->food) { $player->Send(COLOR_HOUSE_NOTENOUGHFOOD, "[ERROR] There is not enough food in your fridge to cook a {$item}"); } else { if (($anim = $player->GetAnimation()) && $anim->stop_data instanceof CookItem) { $player->Send(COLOR_HOUSE_ALREADYCOOKING, "[ERROR] You are already cooking something"); } else { Messages::SendNear($player, COLOR_ACTION, "{$player->name} is cooking {$cook->name}"); $cookanim = clone Houses::$cookanim; $cookanim->steptime = $cook->time; $cookanim->stop_cbk = array('Houses', 'playerCooked'); $cookanim->stop_data = $cook; $player->Animate($cookanim); $room->SetFridge($fridge - $cook->food); } } } }