示例#1
0
        public void BroadcastToOtherCops(Client sender, string text)
        {
            if (API.getEntityData(sender, "IS_COP") != true)
            {
                API.sendChatMessageToPlayer(sender, "~r~ERROR: You're not a cop!");
                return;
            }

            CopUtil.BroadcastToCops("~b~[RADIO] ~h~" + sender.name + "~h~~w~: " + text);
        }
示例#2
0
        public void ArrestPlayer(Client sender, Client target)
        {
            if (API.getEntityData(sender, "IS_COP") != true)
            {
                API.sendChatMessageToPlayer(sender, "~r~ERROR: You're not a cop!");
                return;
            }

            if (target == sender)
            {
                API.sendChatMessageToPlayer(sender, "~r~You cant arrest yourself!");
                return;
            }

            if (API.getEntityData(target, "IS_COP") == true)
            {
                API.sendChatMessageToPlayer(sender, "~r~You cant arrest a cop!");
                return;
            }

            if (API.getEntityPosition(sender).DistanceToSquared(API.getEntityPosition(target)) > 16f)
            {
                API.sendChatMessageToPlayer(sender, "~r~You're too far!");
                return;
            }

            if (API.getEntityData(target, "WantedLevel") == null ||
                API.getEntityData(target, "WantedLevel") <= 2)
            {
                API.sendChatMessageToPlayer(sender, "~r~The player doesn't have an arrest warrant!");
                return;
            }

            API.sendChatMessageToPlayer(sender, "~g~You have arrested " + target.name + "!");
            API.sendChatMessageToPlayer(target, "~g~You have been arrested by " + sender.name + "!");
            API.call("JailController", "jailPlayer", target,
                     WantedLevelDataProvider.GetTimeFromWantedLevel(API.getEntityData(target, "WantedLevel")));

            CopUtil.BroadcastToCops("~b~Player ~h~" + target.name + "~h~ has been arrested!");
        }