public void RespawnGarbageTruck(Client player, vehicle_manager.GameVehicle vehicle) { vehicle.CustomRespawnTimer.Stop(); vehicle.GarbageBags = 0; VehicleManager.respawn_vehicle(vehicle); vehicle.UpdateMarkers(); player.GetCharacter().GarbageTimeLeft = 0; player.GetCharacter().GarbageTimeLeftTimer.Stop(); player.GetCharacter().IsOnGarbageRun = false; player.GetCharacter().update_ped(); player.SendChatMessage("~r~The garbage run has ended. Your garbage truck was removed."); NAPI.ClientEvent.TriggerClientEvent(player, "garbage_removewaypoint"); }
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 MDCSearchForVehicle(Client player, params object[] arguments) { var lic = (string)arguments[0]; vehicle_manager.GameVehicle veh = VehicleManager.Vehicles.FirstOrDefault(x => x.LicensePlate == lic) ?? DatabaseManager.VehicleTable.Find(x => x.LicensePlate == lic) .FirstOrDefault(); if (veh == null) { NAPI.ClientEvent.TriggerClientEvent(player, "MDC_SHOW_VEHICLE_INFO", "", ""); return; } NAPI.ClientEvent.TriggerClientEvent(player, "MDC_SHOW_VEHICLE_INFO", VehicleOwnership.returnCorrDisplayName(veh.VehModel), veh.OwnerName, API.GetVehicleClassName(API.GetVehicleClass(veh.VehModel))); }
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(); }