Пример #1
0
        public static void Delete(int ID)
        {
            FactionInfo Factionobj = GetFactionInfoById(ID);

            FactionList.Remove(Factionobj);
            Factionobj = null;
        }
Пример #2
0
        public void AddScriptFaction(Client player, int IDFaction, int slot, int IDScript)
        {
            PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player);

            if (objplayer.adminlvl < 5)
            {
                API.sendChatMessageToPlayer(player, Constante.PasAdmin);
            }
            else
            {
                FactionInfo objfaction = FactionInfo.GetFactionInfoById(IDFaction);
                if (objfaction == null)
                {
                    API.sendChatMessageToPlayer(player, "~r~Cette faction n'existe pas.");
                    return;
                }
                if (slot != 1 || slot != 2)
                {
                    API.sendChatMessageToPlayer(player, "~r~Le numero de slot doit etre 1 ou 2.");
                    return;
                }
                else
                {
                    if (slot == 1)
                    {
                        objfaction.IDScript1 = IDScript;
                    }
                    else
                    {
                        objfaction.IDScript2 = IDScript;
                    }
                }
            }
        }
Пример #3
0
        public void AddRadioFaction(Client player, int IDFaction)
        {
            PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player);

            if (objplayer.adminlvl < 5)
            {
                API.sendChatMessageToPlayer(player, Constante.PasAdmin);
            }
            else
            {
                FactionInfo objfaction = FactionInfo.GetFactionInfoById(IDFaction);
                if (objfaction == null)
                {
                    API.sendChatMessageToPlayer(player, "~r~Cette faction n'existe pas.");
                    return;
                }
                if (objfaction.HasRadio)
                {
                    objfaction.HasRadio = false;
                    API.sendChatMessageToPlayer(player, "~r~Tu viens de retiré la radio de cette faction.");
                }
                else
                {
                    objfaction.HasRadio = true;
                    API.sendChatMessageToPlayer(player, "~r~Tu viens d'autorisé la radio dans cette faction.");
                }
            }
        }
Пример #4
0
        public void onStart()
        {
            DataTable result = API.exported.database.executeQueryWithResult("SELECT * FROM Factions");

            for (var i = 0; i < result.Rows.Count; i++)
            {
                FactionInfo objfaction = new FactionInfo(Convert.ToInt32(result.Rows[i]["ID"]), Convert.ToString(result.Rows[i]["Nom"]), Convert.ToInt32(result.Rows[i]["IDScript1"]), Convert.ToInt32(result.Rows[i]["IDScript2"]));
            }
        }
Пример #5
0
        public void AddScriptToFaction(int IDFaction, int Slot, int IDScript)
        {
            FactionInfo objfaction = FactionInfo.GetFactionInfoById(IDFaction);

            if (objfaction == null)
            {
                return;
            }
            if (Slot == 1)
            {
                API.shared.exported.database.executeQuery("UPDATE Factions SET IDScript1 ='" + IDScript + "' WHERE ID = '" + objfaction.ID + "'");
                objfaction.IDScript1 = IDScript;
            }
            if (Slot == 2)
            {
                API.shared.exported.database.executeQuery("UPDATE Factions SET IDScript2 ='" + IDScript + "' WHERE ID = '" + objfaction.ID + "'");
                objfaction.IDScript2 = IDScript;
            }
            else
            {
                return;
            }
        }
Пример #6
0
        public static void Command_R(Client player, string message)
        {
            PlayerInfo  objplayer  = PlayerInfo.GetPlayerInfoObject(player);
            FactionInfo objfaction = FactionInfo.GetFactionInfoById(objplayer.factionid);

            if (objfaction == null)
            {
                API.shared.sendChatMessageToPlayer(player, Constante.PasDeFact);
            }
            if (!objfaction.HasRadio)
            {
                API.shared.sendChatMessageToPlayer(player, Constante.PasDeRadioFact);
            }
            else
            {
                if (objplayer.IsFactionDuty == false)
                {
                    API.shared.sendChatMessageToPlayer(player, Constante.PasEnService);
                }
                else
                {
                    switch (objplayer.factionid)
                    {
                    case Constante.Faction_Police:
                    {
                        if (UnitesLSPDInfo.GetUniteLSPDInfoByMembre(player) != null)
                        {
                            UnitesLSPDInfo objUnite  = UnitesLSPDInfo.GetUniteLSPDInfoByMembre(player);
                            var            msgsender = "[Radio] " + Fonction.RemoveUnderscore(player.name) + " " + UnitesLSPDInfo.GetUniteName(objUnite.ID) + " dit: " + message;
                            API.shared.sendChatMessageToPlayer(player, msgsender);
                            List <Client> PlayerDuty = API.shared.getAllPlayers();
                            foreach (Client target in PlayerDuty)
                            {
                                PlayerInfo objtarget = PlayerInfo.GetPlayerInfoObject(target);
                                if (objtarget.factionid == Constante.Faction_Police && objtarget.IsFactionDuty == true && objtarget.Handle != player.handle)
                                {
                                    var msgreceveur = "[Radio] " + Fonction.RemoveUnderscore(player.name) + " " + UnitesLSPDInfo.GetUniteName(objUnite.ID) + " : " + message;
                                    API.shared.sendChatMessageToPlayer(target, Constante.RadioFaction, msgreceveur);
                                }
                            }
                        }
                        else
                        {
                            var msgsender = "[Radio]" + Fonction.RemoveUnderscore(player.name) + " dit: " + message;
                            API.shared.sendChatMessageToPlayer(player, msgsender);
                            List <Client> PlayerDuty = API.shared.getAllPlayers();
                            foreach (Client target in PlayerDuty)
                            {
                                PlayerInfo objtarget = PlayerInfo.GetPlayerInfoObject(target);
                                if (objtarget.factionid == Constante.Faction_Police && objtarget.IsFactionDuty == true)
                                {
                                    var msgreceveur = Fonction.RemoveUnderscore(player.name) + ": " + message;
                                    API.shared.sendChatMessageToPlayer(target, Constante.RadioFaction, msgreceveur);
                                }
                            }
                        }
                        break;
                    }

                    case Constante.Faction_Gardien:
                    {
                        var msgsender = "[Radio]" + Fonction.RemoveUnderscore(player.name) + " dit: " + message;
                        API.shared.sendChatMessageToPlayer(player, msgsender);
                        List <Client> PlayerDuty = API.shared.getAllPlayers();
                        foreach (Client target in PlayerDuty)
                        {
                            PlayerInfo objtarget = PlayerInfo.GetPlayerInfoObject(target);
                            if (objtarget.factionid == Constante.Faction_Gardien && objtarget.IsFactionDuty == true)
                            {
                                var msgreceveur = Fonction.RemoveUnderscore(player.name) + ": " + message;
                                API.shared.sendChatMessageToPlayer(target, Constante.RadioFaction, msgreceveur);
                            }
                        }
                        break;
                    }
                    }
                }
            }
        }