Мануал Система Рации под Redage Войс чат.

Harland David Sanders

Куратор портала
Автор темы
Команда форума
Куратор портала
185
73
57
Система Рации под Redage Войс чат.

C#:
using GTANetworkAPI;
using System.Collections.Generic;
public class Radio {
  public class RadioSystem {
    public static void Radio_Call(Client player, int freq) {
      if (player.HasSharedData("RadioFreq") && player.GetSharedData("RadioFreq") <= -1) {
        return;
      }
      if (player.HasSharedData("RadioFreq") && player.GetSharedData("RadioFreq") == freq) {
        return;
      }
      player.SetSharedData("RadioFreq", freq);
      foreach(Client target in NAPI.Pools.GetAllPlayers()) {
        if (target.GetData("status") == true) {
          if (!player.HasSharedData("RadioFreq")) {
            return;
          }
          if (target.GetSharedData("RadioFreq") == player.GetSharedData("RadioFreq") && target != player) {
            target.TriggerEvent("voice.radio", player);
            player.TriggerEvent("voice.radio", target);
          }
        }
      }
      foreach(Client pl in NAPI.Pools.GetAllPlayers()) {
        if (pl.GetData("status") == true) {
          if (pl.GetSharedData("RadioFreq") != player.GetSharedData("RadioFreq") && pl != player) {
            player.TriggerEvent("v_disconnect", pl);
            pl.TriggerEvent("v_disconnect", player);
          }
        }
      }
    }
    public static void ToggleRadio(Client player, bool deafult = true) {
      if (!deafult) {
        player.SetSharedData("Radio_Status", true);
      }
      if (player.HasSharedData("Radio_Status") && player.GetSharedData("Radio_Status") == true) {
        List < Client > players = NAPI.Player.GetPlayersInRadiusOfPlayer(4, player);
        foreach(Client pl in players) {}
        player.SetSharedData("Radio_Status", false);
        player.TriggerEvent("createNewHeadNotificationAdvanced", "Radio ~y~ Off");
        foreach(Client pl in NAPI.Pools.GetAllPlayers()) {
          if (pl.GetData("status") == true) {
            if (pl.GetSharedData("RadioFreq") == player.GetSharedData("RadioFreq") && pl != player) {
              player.TriggerEvent("v_disconnect", pl);
              pl.TriggerEvent("v_disconnect", player);
            }
          }
        }
      }
      else {
        List < Client > players = NAPI.Player.GetPlayersInRadiusOfPlayer(4, player);
        foreach(Client pl in players) {}
        if (player.HasSharedData("RadioFreq") && player.GetSharedData("RadioFreq") >= 0) {
          Radio_Call(player, player.GetSharedData("RadioFreq"));
        }
        player.SetSharedData("Radio_Status", true);
        player.TriggerEvent("createNewHeadNotificationAdvanced", "Radio ~g~ On");
      }
    }
  }
}
CEF: https://drive.google.com/file/d/1UzKFcMAmviEeaZPzDXoCxylHPPP8z3Sa/view?usp=sharing
 
  • Like
Реакции: nettkom