Beispiel #1
0
        public void QuitterUnite(Client player)
        {
            PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player);

            if (!Fonction.IsPlayerInFaction(objplayer, "Police", true))
            {
                return;
            }
            else if (objplayer.IsFactionDuty == false)
            {
                API.sendChatMessageToPlayer(player, Constante.PasEnService);
                return;
            }
            else if (UnitesLSPDInfo.GetUniteLSPDInfoByMembre(player) == null)
            {
                API.sendChatMessageToPlayer(player, "~r~Tu n'es pas dans une unité.");
                return;
            }
            else
            {
                UnitesLSPDInfo objUnite = UnitesLSPDInfo.GetUniteLSPDInfoByMembre(player);
                if (objUnite.Membres.Count == 1)
                {
                    UnitesLSPDInfo.UnitesList.Remove(objUnite);
                    API.sendChatMessageToPlayer(player, "~g~Tu viens de quitter ton unité.");
                    return;
                }
                else
                {
                    objUnite.Membres.Remove(player);
                    API.sendChatMessageToPlayer(player, "~g~Tu viens de quitter ton unité.");
                    return;
                }
            }
        }
Beispiel #2
0
        public void Soigner(Client player, string idOrName)
        {
            PlayerInfo target    = PlayerInfo.GetPlayerInfotByIdOrName(idOrName);
            PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player);

            if (player.position.DistanceTo(API.getEntityPosition(target.Handle)) >= 2)
            {
                API.sendChatMessageToPlayer(player, Constante.TuEsTropLoin);
                return;
            }
            else if (!Fonction.IsPlayerInFaction(objplayer, "Medecin", true))
            {
                return;
            }
            else
            {
                var anciennebank = target.bank;
                target.bank = anciennebank - Constante.PrixSoinEMS;
                var PayeEMS = Constante.PrixSoinEMS / 2;
                API.sendChatMessageToPlayer(target.Handle, "Tu viens d'être soigner par un médecin, tu as régler la somme de ~g~" + Constante.PrixSoinEMS + "~s~$.");
                API.sendChatMessageToPlayer(player, "Tu viens de soigner cette personne, tu ajoutes ~g~" + PayeEMS + "~s~$ sur ta prochaine paye.");
                var PayeEnAttente = objplayer.pendingpaye;
                objplayer.pendingpaye = PayeEnAttente + PayeEMS;
                API.setPlayerHealth(player, 100);
            }
        }
Beispiel #3
0
        public void BaliseCoupee(Client player)
        {
            PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player);

            if (!Fonction.IsPlayerInFaction(objplayer, "Police", true))
            {
                return;
            }
            objplayer.BaliseLSPD = false;
            List <Client> PlayerDuty = new List <Client>();

            foreach (Client target in API.getAllPlayers())
            {
                PlayerInfo objtarget = PlayerInfo.GetPlayerInfoObject(target);
                if (objtarget.factionid == Constante.Faction_Police && objtarget.IsFactionDuty == true)
                {
                    PlayerDuty.Add(target);
                    var msgreceveur = Fonction.RemoveUnderscore(player.name) + " dit: Demande de renfort annulée.";
                    API.sendChatMessageToPlayer(target, Constante.RadioFaction, msgreceveur);
                }
            }
            foreach (Client TargetDuty in PlayerDuty)
            {
                System.Threading.Thread.Sleep(5000);
                API.triggerClientEvent(TargetDuty, "DeleteBaliseLSPD", String.Format("Balise{0}", player.name));
            }
            Fonction.SendCloseMessage(player, 15.0f, Constante.VioletMe, Fonction.RemoveUnderscore(player.name) + " utilise sa balise GPS.");
        }
Beispiel #4
0
        public void Emprisonner_CMD(Client player, String idOrName, int temps)
        {
            PlayerInfo target = PlayerInfo.GetPlayerInfotByIdOrName(idOrName);

            if (target == null)
            {
                API.sendChatMessageToPlayer(player, Constante.message_id_incorrect);
                return;
            }

            PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player);

            if (!Fonction.IsPlayerInFaction(objplayer, "Police", true))
            {
                return;
            }
            if (!objplayer.IsFactionDuty)
            {
                API.sendChatMessageToPlayer(player, Constante.PasEnService);
                return;
            }
            if (player.position.DistanceTo(Constante.Pos_EntrerPrison) < 4 && target.Handle.position.DistanceTo(Constante.Pos_EntrerPrison) < 4)
            {
                target.position = Constante.Pos_SortiePrison;
                API.setEntityPosition(target.Handle, Constante.Pos_SortiePrison);
                API.sendChatMessageToPlayer(target.Handle, "Tu viens d'être emprisonné pour " + temps + " minutes");
            }
        }
Beispiel #5
0
        public void Amende(Client player, String idOrName, int montant, string raison)
        {
            PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player);
            PlayerInfo objtarget = PlayerInfo.GetPlayerInfotByIdOrName(idOrName);

            if (!Fonction.IsPlayerInFaction(objplayer, "Police", true))
            {
                return;
            }
            if (!objplayer.IsFactionDuty)
            {
                API.sendChatMessageToPlayer(player, Constante.PasEnService);
                return;
            }
            API.sendChatMessageToPlayer(player, "Tu viens de donner une amende de ~g~" + montant + "~s~$ à " + Fonction.RemoveUnderscore(objtarget.PlayerName));
            API.sendChatMessageToPlayer(objtarget.Handle, "Tu viens de recevoir une amende de ~r~" + montant + "~s~$ par " + Fonction.RemoveUnderscore(objplayer.PlayerName) + " pour " + raison);

            int date;

            Int32.TryParse(DateTime.Now.ToString("ddMMyyyyhhmmss"), out date);
            AmendeInfo amende = new AmendeInfo(objtarget.Handle, montant, raison, objplayer.PlayerName, date);

            if (objtarget.money >= montant)
            {
                API.sendChatMessageToPlayer(objtarget.Handle, "Tu possèdes assez d'argent sur toi pour la payer maintenant ~m~(/payeramende " + amende.id + ")~s~.");
                API.sendChatMessageToPlayer(objtarget.Handle, "Pour la payer plus tard au poste tu peux. Si tu attends trop, elle sera prélevée sur ton salaire.");
                return;
            }
            else
            {
                API.sendChatMessageToPlayer(objtarget.Handle, "Rends toi au poste dès que possible pour régler ton amende. Sinon, elle sera prélevée sur ton salaire.");
                API.sendChatMessageToPlayer(objtarget.Handle, "Id de ton amende : " + amende.id + ".");
            }
            API.exported.database.executeQuery("INSERT INTO UtilisateurAmende SET playername = '" + objtarget.PlayerName + "', montant = " + amende.montant + ", raison='" + amende.raison + "', auteur='" + amende.auteur + "', date=" + amende.date);
        }
Beispiel #6
0
        public void Creerpatrouille(Client player)
        {
            PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player);

            if (!Fonction.IsPlayerInFaction(objplayer, "Police", true))
            {
                return;
            }
            if (objplayer.IsFactionDuty == false)
            {
                API.sendChatMessageToPlayer(player, Constante.PasEnService);
                return;
            }
            if (UnitesLSPDInfo.GetUniteLSPDInfoByMembre(player) != null)
            {
                API.sendChatMessageToPlayer(player, "~r~Tu es déjà dans une unité.");
                return;
            }
            if (!player.isInVehicle || VehiculeInfo.GetVehicleInfoByNetHandle(player.vehicle.handle).factionid != Constante.Faction_Police)
            {
                API.sendChatMessageToPlayer(player, "~r~Il faut etre dans un véhicule pour creer une unité.");
            }
            else
            {
                UnitesLSPDInfo Uniteobj = new UnitesLSPDInfo(player, player.vehicle);
                API.sendChatMessageToPlayer(player, "Numéro d'unité : ~g~" + (Uniteobj.ID + 1) + "~s~ | Numéro du véhicule : ~g~" + VehiculeInfo.GetVehicleInfoByNetHandle(player.vehicle.handle).ID);
                return;
            }
        }
Beispiel #7
0
        public void Megaphone(Client player, string message)
        {
            PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player);

            if (!Fonction.IsPlayerInFaction(objplayer, "Police", true))
            {
                return;
            }
            if (!objplayer.IsFactionDuty)
            {
                API.sendChatMessageToPlayer(player, Constante.PasEnService);
                return;
            }
            VehiculeInfo objveh = VehiculeInfo.GetVehicleInfoByNetHandle(player.vehicle);

            if (!player.isInVehicle)
            {
                API.sendChatMessageToPlayer(player, "Tu n'as pas de ~r~mégaphone ~s~sur toi.");
                return;
            }
            if (objveh.factionid != Constante.Faction_Police)
            {
                API.sendChatMessageToPlayer(player, "Tu n'as pas de ~r~mégaphone ~s~dans ton véhicule.");
            }
            else
            {
                Fonction.SendCloseMessage(player, 40.0f, Constante.JauneMegaphone, Fonction.RemoveUnderscore(player.name) + " dit au mégaphone : " + message);
            }
        }
        public void Stopjob(Client player)
        {
            PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player);

            if (Fonction.IsPlayerInFaction(objplayer, "Gardien", false) && objplayer.IsJobDuty)
            {
                var jv = API.getPlayerVehicle(player);
                API.sendChatMessageToPlayer(player, "~g~Reviens au depot ! Un point est indiqué sur ton GPS ! (Touche 'w' au depot pour garer le camion)");
                objplayer.retourconv = true;
                API.setEntityData(jv, "retourcon", true);
                API.triggerClientEvent(player, "retourconv");
            }
        }
        public void OnPlayerEnterVehicleHandle(Client player, NetHandle vehicle, int targetSeat)
        {
            PlayerInfo   objplayer   = PlayerInfo.GetPlayerInfoObject(player);
            VehiculeInfo objvehicule = VehiculeInfo.GetVehicleInfoByNetHandle(vehicle);

            if (objvehicule.jobid == Constante.Job_Convoyeur)
            {
                if (!Fonction.IsPlayerInFaction(objplayer, "Gardien", true))
                {
                    return;
                }
            }
            if (objvehicule.EnVente == true)
            {
                API.triggerClientEvent(player, "MenuVehConcess");
            }
        }
Beispiel #10
0
        public void Verifiervehicule(Client player, String id)
        {
            PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player);

            if (!Fonction.IsPlayerInFaction(objplayer, "Police", true))
            {
                return;
            }
            if (!objplayer.IsFactionDuty)
            {
                API.sendChatMessageToPlayer(player, Constante.PasEnService);
                return;
            }
            int idveh = Int32.Parse(id);
            {
                VehiculeInfo objvehicule = VehiculeInfo.GetVehicleInfoById(idveh);
                API.sendChatMessageToPlayer(player, "Le véhicule appartient à");
            }
        }
Beispiel #11
0
        public void RejoindreUnite(Client player, int NumeroUnite)
        {
            PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player);

            if (!Fonction.IsPlayerInFaction(objplayer, "Police", true))
            {
                return;
            }
            if (objplayer.IsFactionDuty == false)
            {
                API.sendChatMessageToPlayer(player, Constante.PasEnService);
                return;
            }
            if (UnitesLSPDInfo.GetUniteLSPDInfoByMembre(player) != null)
            {
                API.sendChatMessageToPlayer(player, "~r~Tu es déjà dans une unité.");
                return;
            }
            UnitesLSPDInfo objUnite = UnitesLSPDInfo.GetUniteLSPDInfoByID(NumeroUnite - 1);

            if (objUnite == null)
            {
                API.sendChatMessageToPlayer(player, "~r~L'unité demandée n'éxiste pas.");
                return;
            }
            if (objUnite.Membres.Count == 3)
            {
                API.sendChatMessageToPlayer(player, "~r~L'unité demandée est complète.");
                return;
            }
            else
            {
                objUnite.Membres.Add(player);
                for (int i = 0; i < objUnite.Membres.Count; i++)
                {
                    if (objUnite.Membres[i] != player)
                    {
                        API.sendNotificationToPlayer(objUnite.Membres[i], "~g~" + Fonction.RemoveUnderscore(player.name) + "~s~ a rejoint ton unité.");
                    }
                }
            }
        }
Beispiel #12
0
        public void DeMenotter(Client player, String idOrName)
        {
            PlayerInfo target = PlayerInfo.GetPlayerInfotByIdOrName(idOrName);

            if (target == null)
            {
                API.sendChatMessageToPlayer(player, Constante.message_id_incorrect);
            }
            else
            {
                PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player);
                if (!Fonction.IsPlayerInFaction(objplayer, "Police", true))
                {
                    return;
                }
                if (player.position.DistanceTo(API.getEntityPosition(target.Handle)) >= 2)
                {
                    API.sendChatMessageToPlayer(player, Constante.TuEsTropLoin);
                    return;
                }
                else if (objplayer.IsFactionDuty == false)
                {
                    API.sendChatMessageToPlayer(player, Constante.PasEnService);
                    return;
                }
                else if (target.IsMenotter == false)
                {
                    API.sendChatMessageToPlayer(player, "Tu ne peux pas ~r~démenotter ~s~une personne qui n'est pas menottée.");
                    return;
                }
                else
                {
                    API.sendChatMessageToPlayer(player, "Tu viens de ~g~démenotter ~s~cette personne.");
                    API.sendChatMessageToPlayer(target.Handle, "Tu viens d'être ~g~démenotté ~s~par un policier.");
                    target.IsMenotter = false;
                    API.setPlayerClothes(target.Handle, 7, 0, 0);
                    API.stopPlayerAnimation(target.Handle);
                }
            }
            return;
        }
Beispiel #13
0
        public void Balise(Client player)
        {
            PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player);

            if (!Fonction.IsPlayerInFaction(objplayer, "Police", true))
            {
                return;
            }
            objplayer.BaliseLSPD = true;
            List <PlayerInfo> Joueurs     = PlayerInfo.PlayerList;
            List <Client>     JoueursDuty = new List <Client>();

            foreach (PlayerInfo joueur in Joueurs)
            {
                if (joueur.factionid == Constante.Faction_Police && joueur.IsFactionDuty == true)
                {
                    JoueursDuty.Add(joueur.Handle);
                    var msgreceveur = Fonction.RemoveUnderscore(player.name) + " dit: Besoin de renfort sur notre balise GPS.";
                    API.sendChatMessageToPlayer(joueur.Handle, Constante.RadioFaction, msgreceveur);
                }
            }
            Fonction.SendCloseMessage(player, 15.0f, Constante.VioletMe, Fonction.RemoveUnderscore(player.name) + " utilise sa balise GPS.");
            foreach (Client TargetDuty in JoueursDuty)
            {
                API.sendChatMessageToPlayer(player, "test 1");
                API.triggerClientEvent(player, "BaliseLSPD", player.position.X, player.position.Y, player.position.Z, String.Format("Balise{0}", player.name));
            }
            while (objplayer.BaliseLSPD == true)
            {
                System.Threading.Thread.Sleep(2000);
                foreach (Client TargetDuty in JoueursDuty)
                {
                    API.sendChatMessageToPlayer(player, "test 2");
                    API.triggerClientEvent(TargetDuty, "DeleteBaliseLSPD", String.Format("Balise{0}", player.name));
                    API.triggerClientEvent(player, "BaliseLSPD", player.position.X, player.position.Y, player.position.Z, String.Format("Balise{0}", player.name));
                }
            }
        }
Beispiel #14
0
        public void Menotter(Client player, String idOrName)
        {
            PlayerInfo target = PlayerInfo.GetPlayerInfotByIdOrName(idOrName);

            if (target == null)
            {
                API.sendChatMessageToPlayer(player, Constante.message_id_incorrect);
            }
            else
            {
                PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player);
                if (!Fonction.IsPlayerInFaction(objplayer, "Police", true))
                {
                    return;
                }
                if (player.position.DistanceTo(API.getEntityPosition(target.Handle)) >= 2)
                {
                    API.sendChatMessageToPlayer(player, Constante.TuEsTropLoin);
                    return;
                }
                else if (objplayer.IsFactionDuty == false)
                {
                    API.sendChatMessageToPlayer(player, Constante.PasEnService);
                    return;
                }
                else if (target.IsMenotter == true)
                {
                    API.sendChatMessageToPlayer(player, "Tu ne peux pas ~r~menotter ~s~une personne qui l'est déjà.");
                    return;
                }
                API.setPlayerClothes(target.Handle, 7, (target.sexe == 0 ? 41 : 25), 0);
                API.sendChatMessageToPlayer(player, "Tu viens de ~g~menotter ~s~cette personne.");
                API.sendChatMessageToPlayer(target.Handle, "Tu viens d'être ~r~menotté ~s~par un policier.");
                target.IsMenotter = true;
                API.playPlayerAnimation(target.Handle, (int)(AnimationFlags.Loop | AnimationFlags.OnlyAnimateUpperBody | AnimationFlags.AllowPlayerControl), "mp_arresting", "idle");
            }
            return;
        }
Beispiel #15
0
        public void ClientEvent(Client player, PlayerInfo objplayer, string eventName)
        {
            switch (eventName)
            {
                #region Bouton E
            case "Bouton.E":
                //Entrée Auto-Ecole
                if (!player.isInVehicle && player.position.DistanceTo(Constante.Pos_EntrerAutoEcole) < 2)
                {
                    API.setEntityPosition(player, Constante.Pos_SortieAutoEcole);
                    return;
                }

                if (!player.isInVehicle && player.position.DistanceTo(Constante.Pos_EntrerPrison) < 4 && objplayer.factionid == Constante.Faction_Gardien)
                {
                    API.setEntityPosition(player, Constante.Pos_SortiePrison);
                    objplayer.IsFactionDuty = true;
                    API.sendChatMessageToPlayer(player, "~#d2d628~", "Tu viens de prendre ton service.");

                    if (objplayer.sexe == 0)
                    {
                        API.setPlayerClothes(player, 3, 0, 0);
                        API.setPlayerClothes(player, 4, 35, 0);
                        API.setPlayerClothes(player, 5, 0, 0);
                        API.setPlayerClothes(player, 6, 25, 0);
                        API.setPlayerClothes(player, 7, 0, 0);
                        API.setPlayerClothes(player, 8, 58, 0);
                        API.setPlayerClothes(player, 11, 55, 0);
                    }
                    else
                    {
                        API.setPlayerClothes(player, 3, 14, 0);
                        API.setPlayerClothes(player, 4, 34, 0);
                        API.setPlayerClothes(player, 5, 0, 0);
                        API.setPlayerClothes(player, 6, 25, 0);
                        API.setPlayerClothes(player, 7, 0, 0);
                        API.setPlayerClothes(player, 8, 35, 0);
                        API.setPlayerClothes(player, 11, 48, 0);
                    }
                    API.givePlayerWeapon(player, WeaponHash.Flashlight, 1, true, true);
                    API.givePlayerWeapon(player, WeaponHash.StunGun, 1, true, true);
                    API.givePlayerWeapon(player, WeaponHash.Nightstick, 1, true, true);
                    return;
                }
                if (!player.isInVehicle && player.position.DistanceTo(Constante.Pos_SortiePrison) < 4 && objplayer.factionid == Constante.Faction_Gardien)
                {
                    API.setEntityPosition(player, Constante.Pos_EntrerPrison);
                    objplayer.IsFactionDuty = false;
                    API.removeAllPlayerWeapons(player);
                    objplayer.armure = 0;
                    API.sendChatMessageToPlayer(player, "~#d2d628~", "Tu viens de terminer ton service.");
                    API.call("Connexion", "LoadVetements", player);
                    API.call("Connexion", "LoadAccessoires", player);
                    return;
                }

                //Sortie Auto-Ecole
                if (!player.isInVehicle && player.position.DistanceTo(Constante.Pos_SortieAutoEcole) < 2)
                {
                    API.setEntityPosition(player, Constante.Pos_EntrerAutoEcole);
                    return;
                }

                //Job eboueur
                if (!player.isInVehicle && player.position.DistanceTo(Constante.Pos_ServiceEboueur) < 2)
                {
                    if (objplayer.jobid == Constante.Job_Eboueur)
                    {
                        if (objplayer.IsJobDuty == false)
                        {
                            API.setPlayerClothes(player, 3, 119, 0);
                            API.setPlayerClothes(player, 4, 36, 0);
                            API.setPlayerClothes(player, 6, 51, 0);
                            API.setPlayerClothes(player, 8, 59, 0);
                            API.setPlayerClothes(player, 11, 57, 0);
                            objplayer.IsJobDuty = true;
                        }
                        else
                        {
                            objplayer.IsJobDuty = false;
                            if (objplayer.pendingpaye > 0)
                            {
                                API.sendChatMessageToPlayer(player, "Merci pour ton travail, tu reçevra ton argent sur ta prochaine paye!");
                            }
                            Connexion lv = new Connexion();
                            lv.LoadVetements(player);
                            lv.LoadAccessoires(player);
                            return;
                        }
                    }
                    else
                    {
                        API.sendChatMessageToPlayer(player, "~r~Tu ne fais pas partie ~s~de ce job, fais toi d'abord recruter. ~m~(/rejoindreeboueur)");
                    }
                }

                //Menu Auto-Ecole
                if (!player.isInVehicle && player.position.DistanceTo(new Vector3(-139.1808, -631.9503, 168.8204)) < 2)
                {
                    API.triggerClientEvent(player, "MenuAutoEcole");
                    return;
                }

                //Menu Armurerie
                if (police.isArmurerieLSPD(player))
                {
                    if (!Fonction.IsPlayerInFaction(objplayer, "Police", true))
                    {
                        return;
                    }
                    if (objplayer.IsFactionDuty == true)
                    {
                        API.triggerClientEvent(player, "MenuArmurerieLSPD");
                    }
                    else
                    {
                        API.sendChatMessageToPlayer(player, Constante.PasEnService);
                    }
                    return;
                }

                //menu cellule
                if (police.isCellule(player))
                {
                    if (!Fonction.IsPlayerInFaction(objplayer, "Police", true))
                    {
                        return;
                    }
                    if (objplayer.IsFactionDuty == true)
                    {
                        API.triggerClientEvent(player, "MenuCelluleLSPD");
                    }
                    else
                    {
                        API.sendChatMessageToPlayer(player, Constante.PasEnService);
                    }
                    return;
                }

                //Menu Distrib
                if (police.isDistrib(player))
                {
                    API.triggerClientEvent(player, "MenuDistrib");
                    return;
                }

                //Menu Service
                if (police.isService(player))
                {
                    if (Fonction.IsPlayerInFaction(objplayer, "Police", true))
                    {
                        API.triggerClientEvent(player, "MenuService");
                    }
                    return;
                }

                //Menu Armurerie civile
                if (Fonction.isArmurerieCivil(player))
                {
                    API.triggerClientEvent(player, "MenuArmurerieCivil");
                    return;
                }

                //Menu ATM
                if (ATMInfo.GetATMInfoClosePos(player.position, 2) != null)
                {
                    if (Fonction.IsPlayerInFaction(objplayer, "Gardien", false) && objplayer.IsJobDuty == true)
                    {
                        objplayer.sacbanque = false;
                        API.setPlayerClothes(player, 5, 0, 0);
                    }
                    else
                    {
                        API.triggerClientEvent(player, "showATM");
                        objplayer.IdATM = ATMInfo.GetATMInfoClosePos(player.position, 2).ID;
                        API.setEntitySyncedData(player, "SoldeCompte", objplayer.bank);
                    }
                    return;
                }

                //Menu Banque
                if (BanqueInfo.GetBanqueInfoClosePos(player.position, 1) != null)
                {
                    API.triggerClientEvent(player, "MenuBanque");
                    objplayer.IdBanque = BanqueInfo.GetBanqueInfoClosePos(player.position, 1).ID;
                    return;
                }

                //Menu Magasin
                if (Magasin.isMagasin(player))
                {
                    API.triggerClientEvent(player, "MenuMagasin");
                    return;
                }

                //Menu Revendeur
                if (Magasin.isRevendeur(player))
                {
                    API.triggerClientEvent(player, "MenuRevendeur");
                    return;
                }

                //Menu Logement
                if (Logement.IsLogement(player))
                {
                    if (Logement.HasProprietaire(player, Logement.GetLogementIDProche(player)))
                    {
                        if (Logement.PlayerHaveKeyHouse(player, Logement.GetLogementIDProche(player)))
                        {
                            API.triggerClientEvent(player, "MenuMaisonAchetéeProprio");
                        }
                        else
                        {
                            API.triggerClientEvent(player, "MenuMaisonAchetéeNonProprio");
                        }
                    }
                    else
                    {
                        API.triggerClientEvent(player, "MenuMaisonAVendre");
                    }
                    return;
                }

                //Entrée Planque
                if (CommandesFaction.IsEntreePlanque(player) && objplayer.dimension == 0)
                {
                    System.Data.DataTable result = API.shared.exported.database.executeQueryWithResult("SELECT * FROM PlanqueFaction");
                    if (result.Rows.Count != 0)
                    {
                        foreach (System.Data.DataRow row in result.Rows)
                        {
                            String nominte        = Convert.ToString(row["nominte"]);
                            int    PorteOuverture = Convert.ToInt32(row["locked"]);
                            if (PorteOuverture == 1)
                            {
                                API.shared.sendNotificationToPlayer(player, "La porte est fermée.");
                            }
                            else
                            {
                                if (nominte == "InteArmes")
                                {
                                    API.shared.setEntityPosition(player, CommandesFaction.InteArmes);
                                    objplayer.IsOnInt          = true;
                                    objplayer.IsOnPlanqueArmes = true;
                                    API.shared.setEntityDimension(player, Convert.ToInt32(row["ID"]));
                                    objplayer.dimension = Convert.ToInt32(row["ID"]);
                                    return;
                                }
                                if (nominte == "InteDrogues")
                                {
                                    //API.shared.setEntityPosition(player, InteDrogues);
                                    API.shared.sendChatMessageToPlayer(player, "En maintenance.");
                                    objplayer.IsOnInt          = true;
                                    objplayer.IsOnPlanqueArmes = true;
                                    API.shared.setEntityDimension(player, Convert.ToInt32(row["ID"]));
                                    objplayer.dimension = Convert.ToInt32(row["ID"]);
                                    return;
                                }
                            }
                        }
                    }
                }

                //Sortie Planque
                if (CommandesFaction.IsSortiePlanque(player) && objplayer.dimension != 0)
                {
                    System.Data.DataTable result = API.shared.exported.database.executeQueryWithResult("SELECT * FROM PlanqueFaction");
                    if (result.Rows.Count != 0)
                    {
                        foreach (System.Data.DataRow row in result.Rows)
                        {
                            objplayer.IsOnInt = false;
                            API.shared.setEntityDimension(player, 0);
                            objplayer.dimension = 0;
                            Vector3 logpos = new Vector3(float.Parse(String.Format("" + row["PosX"])), float.Parse(String.Format("" + row["PosY"])), float.Parse(String.Format("" + row["PosZ"])));
                            API.shared.setEntityPosition(player, logpos);
                            objplayer.IsOnPlanqueArmes = false;
                            return;
                        }
                    }
                }

                //Menu hackeur
                if (Hackeur.isRepairePNJ(player))
                {
                    API.triggerClientEvent(player, "MenuPNJHackeur");
                    return;
                }
                if (API.getEntityData(player, "OrdiHack") == true)
                {
                    API.triggerClientEvent(player, "MenuHackeur");
                    return;
                }
                if (Hackeur.isRepaireDehors(player))
                {
                    API.setEntityPosition(player, new Vector3(1274.184, -1719.719, 54.77145));
                    return;
                }
                if (Hackeur.isRepaireDedans(player))
                {
                    API.setEntityPosition(player, new Vector3(882.7369, -1052.517, 33.00666));
                    return;
                }

                //menu exte veh
                if (!player.isInVehicle)
                {
                    VehiculeInfo objveh = VehiculeInfo.GetVehicleArroundPlayer(player);
                    if (objveh != null)
                    {
                        API.triggerClientEvent(player, "MenuExteVeh");
                    }
                    return;
                }

                //menu veh eboueur
                if (player.position.DistanceTo(Constante.Pos_CamionEboueur) < 2)
                {
                    if (objplayer.jobid == Constante.Job_Eboueur)
                    {
                        if (objplayer.IsJobDuty == true)
                        {
                            API.triggerClientEvent(player, "MenuVehEboueur");
                        }
                        else
                        {
                            API.sendChatMessageToPlayer(player, "Tu n'es pas en service.");
                        }
                    }
                    else
                    {
                        API.sendChatMessageToPlayer(player, "Tu n'es pas éboueur.");
                    }
                    return;
                }
                break;

                #endregion
                #region Bouton F1
            case "Bouton.F1":
                //menu inte veh
                if (player.isInVehicle == true)
                {
                    if (player.isInVehicle == true)
                    {
                        API.triggerClientEvent(player, "MenuInteVeh");
                    }
                    return;
                }
                break;

                #endregion
                #region Bouton F2
            case "Bouton.F2":
                //menu Unite LSPD
                if (objplayer.factionid == Constante.Faction_Police && UnitesLSPDInfo.GetUniteLSPDInfoByMembre(player) != null)
                {
                    API.triggerClientEvent(player, "MenuUniteLSPD");
                    return;
                }
                break;

                #endregion
                #region Bouton R
            case "Bouton.R":
                //event rechargement
                if (Inventaire.GetItemNumberInBDD(player, 11) != 0)
                {
                    API.triggerClientEvent(player, "RechargementPistol");
                }
                if (Inventaire.GetItemNumberInBDD(player, 12) != 0)
                {
                    API.triggerClientEvent(player, "RechargementSMG");
                }
                if (Inventaire.GetItemNumberInBDD(player, 13) != 0)
                {
                    API.triggerClientEvent(player, "RechargementRifle");
                }
                if (Inventaire.GetItemNumberInBDD(player, 14) != 0)
                {
                    API.triggerClientEvent(player, "RechargementPompe");
                }
                break;
                #endregion
            }
        }
Beispiel #16
0
 public void ScriptEvent(Client sender, PlayerInfo objplayer, string eventName)
 {
     if (eventName == "ConvoyeurKeyPressed" && !API.isPlayerInAnyVehicle(sender))
     {
         VehiculeInfo objvehicule = VehiculeInfo.GetVehicleArroundPlayer(sender);
         if (objvehicule == null)
         {
             return; /* ??? c bon sa*/
         }
         if (objplayer.sacbanque == true)
         {
             var sacs = objvehicule.sacs;
             if (sacs != 5)
             {
                 var asacs = sacs + 1;
                 objvehicule.sacs    = asacs;
                 objplayer.sacbanque = false;
                 API.setPlayerClothes(sender, 5, 0, 0);
                 if (asacs == 5)
                 {
                     API.sendChatMessageToPlayer(sender, "~g~Le camion est plein ! Tu peux y aller !");
                 }
             }
         }
         else
         {
             var sacs = objvehicule.sacs;
             if (sacs != 0)
             {
                 objplayer.sacbanque = true;
                 var nsacs = sacs - 1;
                 API.setPlayerClothes(sender, 5, 45, 0);
                 objvehicule.sacs = nsacs;
                 if (nsacs == 0)
                 {
                     API.sendChatMessageToPlayer(sender, "~g~Tu viens de prendre le dernier sac ! Remplis l'ATM puis choisis entre recommencer (se rendre au point indiqué) ou arreter (/stopjob) !");
                     API.triggerClientEvent(sender, "pointconv");
                 }
             }
         }
     }
     if (eventName == "DepotConvKey" && !API.isPlayerInAnyVehicle(sender) && sender.position.DistanceTo(Constante.Pos_DepotConvoyeur) < 2)
     {
         if (Fonction.IsPlayerInFaction(objplayer, "Gardien", false))
         {
             if (objplayer.IsJobDuty != true)
             {
                 if (objplayer.sexe == 0)
                 {
                     int[] draw = { 0, 0, -1, 44, 31, 0, 24, 0, 23, 0, 0, 130 };
                     int[] tex  = { 0, 0, -1, 0, 0, 0, 0, 0, 2, 0, 0, 0 };
                     for (int i = 0; i < draw.Length; i++)
                     {
                         API.setPlayerClothes(sender, i, draw[i], tex[i]);
                     }
                     API.setPlayerAccessory(sender, 0, 65, 0);
                 }
                 else
                 {
                     int[] draw = { 0, 0, -1, 49, 32, 0, 25, 0, 2, 0, 0, 127 };
                     int[] tex  = { 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                     for (int i = 0; i < draw.Length; i++)
                     {
                         API.setPlayerClothes(sender, i, draw[i], tex[i]);
                     }
                     API.setPlayerAccessory(sender, 0, 64, 0);
                 }
                 objplayer.IsJobDuty = true;
                 objplayer.sacbanque = false;
                 API.sendNotificationToPlayer(sender, "~g~Montes dans un ~r~camion ~g~et rends toi au ~r~point ~g~indiqué.");
                 API.triggerClientEvent(sender, "pointconv");
             }
             else
             {
                 API.sendNotificationToPlayer(sender, "~g~Tu viens de te retirer du service.");
                 Connexion lv = new Connexion();
                 API.clearPlayerAccessory(sender, 0);
                 lv.LoadVetements(sender);
                 lv.LoadAccessoires(sender);
                 objplayer.IsJobDuty = false;
             }
         }
         else
         {
             API.sendChatMessageToPlayer(sender, "~r~Tu n'es pas Convoyeur de Fonds");
         }
     }
     if (eventName == "ConvoyeurKeyPressed" && API.isPlayerInAnyVehicle(sender) && objplayer.retourconv == true && sender.position.DistanceTo(new Vector3(490.227, -1402.756, 29.32529)) < 4)
     {
         VehiculeInfo objvehicule = VehiculeInfo.GetVehicleInfoByNetHandle(sender.vehicle);
         if (objvehicule.jobid == Constante.Job_Convoyeur)
         {
             Client[] jo = API.getVehicleOccupants(objvehicule.handle);
             foreach (Client value in jo)
             {
                 API.warpPlayerOutOfVehicle(value);
                 objplayer.retourconv = false;
             }
             API.setEntityPosition(objvehicule.handle, objvehicule.pos);
             API.setEntityRotation(objvehicule.handle, objvehicule.rot);
             objvehicule.sacs = 0;
             API.setVehicleEngineStatus(objvehicule.handle, false);
         }
     }
 }