public void unloadtrash_cmd(Client player) { Character character = player.GetCharacter(); if (character.JobOne.Type != JobManager.JobTypes.Garbageman) { player.SendChatMessage("You must be a garbageman to use this command!"); return; } if (!character.IsOnGarbageRun) { player.SendChatMessage("You must be on a garbage run to unload trash."); return; } if (player.Position.DistanceTo(character.JobOne.MiscOne.Location) > 10) { player.SendChatMessage("You must be at the trash depot to unload the trash."); return; } vehicle_manager.GameVehicle closestVeh = VehicleManager.GetClosestVehicle(player, 10f).GetVehicle(); if (closestVeh == null || closestVeh.Job.Type != JobManager.JobTypes.Garbageman) { player.SendChatMessage("~r~You must be at the back of your garbage truck to unload the trash."); return; } if (player.Rotation.Z > API.GetEntityRotation(closestVeh.NetHandle).Z + 20 || player.Rotation.Z < API.GetEntityRotation(closestVeh.NetHandle).Z - 20) { player.SendChatMessage("~r~You must be at the back of your garbage truck to unload the trash."); return; } if (closestVeh.GarbageBags == 0) { player.SendChatMessage("~r~Your garbage truck has no trash to unload!"); return; } LogManager.Log(LogManager.LogTypes.Stats, $"[Job] {character.CharacterName}[{player.GetAccount().AccountName}] has earned ${closestVeh.GarbageBags * 100} from a garbage run."); InventoryManager.GiveInventoryItem(character, new Money(), closestVeh.GarbageBags * 100); ChatManager.RoleplayMessage(character, "uses the garbage truck's control panel to unload the trash.", ChatManager.RoleplayMe); player.SendChatMessage($"You were paid ${closestVeh.GarbageBags * 100} for unloading {closestVeh.GarbageBags} trash bags."); closestVeh.GarbageBags = 0; closestVeh.UpdateMarkers(); API.Shared.SendPictureNotificationToPlayer(player, $"Thanks for keeping Los Santos clean!", "CHAR_PROPERTY_CAR_SCRAP_YARD", 0, 1, "Los Santos Sanitations", "Garbage Notification"); }
public void GarbageThrowBag(Client player, params object[] arguments) { Character character = player.GetCharacter(); API.DeleteEntity(character.GarbageBag); character.GarbageBag = null; vehicle_manager.GameVehicle closestVeh = VehicleManager.GetClosestVehicle(player, 10f).GetVehicle(); if (NAPI.Player.IsPlayerInAnyVehicle(player)) { player.SendChatMessage("You cannot be in a vehicle while doing this."); return; } if (closestVeh == null || closestVeh.Job.Type != JobManager.JobTypes.Garbageman) { ChatManager.RoleplayMessage(character, "throws the garbage bag into the air.", ChatManager.RoleplayMe); player.SendChatMessage("~r~You must throw the garbage bag into the back of the garbage truck!"); return; } if (player.Rotation.Z > API.GetEntityRotation(closestVeh.NetHandle).Z + 30 || player.Rotation.Z < API.GetEntityRotation(closestVeh.NetHandle).Z - 30) { ChatManager.RoleplayMessage(character, "throws the garbage bag at the garbage truck and misses.", ChatManager.RoleplayMe); player.SendChatMessage("~r~You failed to throw the garbage bag into the back of the garbage truck!"); return; } if (closestVeh.GarbageBags >= 10) { ChatManager.RoleplayMessage(character, "throws the garbage bag at the garbage truck and the garbage goes everywhere!", ChatManager.RoleplayMe); player.SendChatMessage("~r~Garbage trucks can only hold 10 bags!"); return; } ChatManager.RoleplayMessage(character, "successfully throws the garbage bag into the garbage truck.", ChatManager.RoleplayMe); player.SendChatMessage("~b~Pick up another garbage bag if you have time or deliver the garbage bags to the depot!"); closestVeh.GarbageBags += 1; closestVeh.UpdateMarkers(); }
private void API_onClientEventTrigger(Client player, string eventName, params object[] arguments) { switch (eventName) { case "garbage_throwbag": { Character character = player.GetCharacter(); API.DeleteEntity(character.GarbageBag); character.GarbageBag = null; vehicle_manager.Vehicle closestVeh = VehicleManager.GetClosestVehicle(player, 10f).GetVehicle(); if (API.IsPlayerInAnyVehicle(player)) { player.SendChatMessage("You cannot be in a vehicle while doing this."); return; } if (closestVeh == null || closestVeh.Job.Type != JobManager.JobTypes.Garbageman) { ChatManager.RoleplayMessage(character, "throws the garbage bag into the air.", ChatManager.RoleplayMe); player.SendChatMessage("~r~You must throw the garbage bag into the back of the garbage truck!"); return; } if (player.rotation.Z > API.GetEntityRotation(closestVeh.NetHandle).Z + 30 || player.rotation.Z < API.GetEntityRotation(closestVeh.NetHandle).Z - 30) { ChatManager.RoleplayMessage(character, "throws the garbage bag at the garbage truck and misses.", ChatManager.RoleplayMe); player.SendChatMessage("~r~You failed to throw the garbage bag into the back of the garbage truck!"); return; } if (closestVeh.GarbageBags >= 10) { ChatManager.RoleplayMessage(character, "throws the garbage bag at the garbage truck and the garbage goes everywhere!", ChatManager.RoleplayMe); player.SendChatMessage("~r~Garbage trucks can only hold 10 bags!"); return; } ChatManager.RoleplayMessage(character, "successfully throws the garbage bag into the garbage truck.", ChatManager.RoleplayMe); player.SendChatMessage("~b~Pick up another garbage bag if you have time or deliver the garbage bags to the depot!"); closestVeh.GarbageBags += 1; closestVeh.UpdateMarkers(); break; } case "garbage_pickupbag": { Character character = player.GetCharacter(); if (character == null) { return; } if (character.JobOne?.Type != JobManager.JobTypes.Garbageman) { return; } pickuptrash_e(character.Client); break; } } }