/// <summary> /// Called when <see cref="ENetworkMessages.RequestBackup"/> has been received. /// </summary> /// <param name="sender">The sender.</param> /// <param name="message">The message.</param> private void NeedBackupHandlerFunction(NetworkServer sender, ReceivedUserMessage message) { // Read position and get associated area. Vector3 position = message.ReadVector3(); string area = Functions.GetAreaStringFromPosition(position); // Display message and blip. Functions.PrintText(string.Format("Officer {0} requests backup at {1}", sender.SafeName, area), 5000); Blip areaBlip = Functions.CreateBlipForArea(position, 25f); // Cleanup. DelayedCaller.Call(parameter => areaBlip.Delete(), this, 10000); }
/// <summary> /// Called when <see cref="NetworkMessages.RequestBackup"/> has been received. /// </summary> /// <param name="sender">The sender.</param> /// <param name="message">The message.</param> private void NeedBackupHandlerFunction(NetworkServer sender, ReceivedUserMessage message) { // The codes below are taken from the latest pull of LCPDFR API on GitHub (or latest download from LCPDFR website). // If you are the developer feel free to have fun with this handler (or add one other handler and mod it your way). // Read position and get associated area. Vector3 position = message.ReadVector3(); string area = Functions.GetAreaStringFromPosition(position); // Display message and blip. Functions.PrintText(string.Format("Officer {0} requests backup at {1}", sender.SafeName, area), 10000); Blip areaBlip = Functions.CreateBlipForArea(position, 25f); // Play sound. int rand = Common.GetRandomValue(0, 4); switch (rand) { case 0: Functions.PlaySoundUsingPosition("THIS_IS_CONTROL UNITS_PLEASE_BE_ADVISED INS_I_NEED_A_UNIT_FOR CRIM_AN_OFFICER_IN_NEED_OF_ASSISTANCE IN_OR_ON_POSITION", position); break; case 1: Functions.PlaySoundUsingPosition("THIS_IS_CONTROL ASSISTANCE_REQUIRED FOR CRIM_AN_OFFICER_IN_NEED_OF_ASSISTANCE IN_OR_ON_POSITION", position); break; case 2: Functions.PlaySoundUsingPosition("INS_THIS_IS_CONTROL_WE_HAVE CRIM_AN_OFFICER_IN_NEED_OF_ASSISTANCE IN_OR_ON_POSITION", position); break; case 3: Functions.PlaySoundUsingPosition("ALL_UNITS_ALL_UNITS INS_WE_HAVE CRIM_AN_SOS FOR CRIM_AN_OFFICER_IN_NEED_OF_ASSISTANCE IN_OR_ON_POSITION", position); break; } Log.Info("Client: Server issued a backup request on coordinates " + position.ToString() + " (Area: " + area + ")", this); // Cleanup. DelayedCaller.Call(parameter => areaBlip.Delete(), this, 20000); }