Beispiel #1
0
 public static void RemoveColocataire(int IDlogement, int Colocataire)
 {
     API.shared.exported.database.executeQuery("UPDATE Logements SET IDColocataire='-1' WHERE ID = '" + IDlogement + "'");
     Logement.RemoveHomeKeyToPlayer(Colocataire, IDlogement);
 }
Beispiel #2
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 #3
0
        /*[Command("definirplace", "~y~JOUEUR: ~s~/definirplace")]
         * public void Definirplace(Client player)
         * {
         *  if (!player.isInVehicle)
         *  {
         *      API.sendChatMessageToPlayer(player, "Tu n'es pas dans un ~r~Vehicule~s~.");
         *      return;
         *  }
         *  if(!SpawnVehicule.VerifDispoPlaceParking(player.vehicle.position))
         *  {
         *      API.sendChatMessageToPlayer(player, "Cette ~r~place ~s~est déjà ~r~utilisée ~s~par un autre vehicule.");
         *      return;
         *  }
         *  VehiculeInfo objveh = VehiculeInfo.GetVehicleInfoByNetHandle(player.vehicle);
         *  PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player);
         *  if (objveh.IDBDDProprio != objplayer.dbid)
         *  {
         *      API.sendChatMessageToPlayer(player, "Tu n'es pas ~r~propriétaire ~s~de ce ~r~Vehicule~s~.");
         *      return;
         *  }
         *  if (IsProprietaire(player) && player.position.DistanceTo(GetLogementPos(GetLogementID(player))) < 30)
         *  {
         *      SpawnVehicule.SetVehSpawnPoint(player.vehicle, player.vehicle.position, player.vehicle.rotation);
         *      API.sendChatMessageToPlayer(player, "La ~g~place de parking ~s~de ton ~g~Vehicule ~s~a bien été définis.");
         *      return;
         *  }
         *  if (IsLocataire(player) && player.position.DistanceTo(GetLogementPos(GetIdLogementLocataire(player))) < 30)
         *  {
         *      SpawnVehicule.SetVehSpawnPoint(player.vehicle, player.vehicle.position, player.vehicle.rotation);
         *      API.sendChatMessageToPlayer(player, "La ~g~place de parking ~s~de ton ~g~Vehicule ~s~a bien été définis.");
         *      return;
         *  }
         *  else
         *  {
         *      SpawnVehicule.SetVehSpawnPoint(player.vehicle, player.vehicle.position, player.vehicle.rotation);
         *      objplayer.money = objplayer.money - 500;
         *      API.shared.triggerClientEvent(player, "update_money_display", objplayer.money);
         *      API.sendChatMessageToPlayer(player, "La ~g~place de parking ~s~de ton ~g~Vehicule ~s~a bien été définis pour 500$.");
         *      return;
         *  }
         *
         * }*/

        #region ScriptEvent

        public void ScriptEvent(Client sender, PlayerInfo objplayer)
        {
            if (!API.isPlayerInAnyVehicle(sender))
            {
                #region AccesGarageVersLogement
                if (!sender.isInVehicle & sender.position.DistanceTo(new Vector3(179.0791, -1000.706, -98.99995)) < 2)
                {
                    DataTable result = API.exported.database.executeQueryWithResult("SELECT * FROM Logements WHERE ID = '" + objplayer.dimension + "'");
                    foreach (DataRow row in result.Rows)
                    {
                        String app = Convert.ToString(row["model"]);
                        if (app == "app1")
                        {
                            Logement test = new Logement();
                            API.setEntityPosition(sender, test.app1);
                            objplayer.IsOnInt = true;
                        }
                        if (app == "app2")
                        {
                            Logement test = new Logement();
                            API.setEntityPosition(sender, test.app2);
                            objplayer.IsOnInt = true;
                        }
                    }
                    return;
                }
                #endregion

                #region AccesGarageVersExterieur
                if (!sender.isInVehicle & sender.position.DistanceTo(new Vector3(172.8933, -1007.904, -98.99995)) < 2)
                {
                    DataTable result = API.exported.database.executeQueryWithResult("SELECT * FROM Garages WHERE ID = '" + objplayer.dimension + "'");
                    foreach (DataRow row in result.Rows)
                    {
                        API.triggerClientEvent(sender, "MenuGarageToExt");

                        /*API.setEntityPosition(sender, new Vector3(Convert.ToDouble(row["PosX"]), Convert.ToDouble(row["PosY"]), Convert.ToDouble(row["PosZ"])));
                         * API.setEntityDimension(sender, 0);
                         * objplayer.dimension = 0;
                         * objplayer.IsOnInt = false;*/
                        return;
                    }
                }
                #endregion

                #region AccesLogementVersExterieur
                if (objplayer.IsOnInt == true)
                {
                    int       IDlog  = API.getEntityDimension(sender);
                    DataTable result = API.exported.database.executeQueryWithResult("SELECT * FROM Logements WHERE ID = '" + IDlog + "'");
                    foreach (DataRow row in result.Rows)
                    {
                        String app = Convert.ToString(row["model"]);
                        if (app == "app1")
                        {
                            Vector3 pos = new Vector3(266.2844, -1007.04, -100.9328);
                            if (sender.position.DistanceTo(pos) < 2)
                            {
                                API.triggerClientEvent(sender, "MenuSortirLogement");
                            }
                        }
                        if (app == "app2")
                        {
                            Vector3 pos = new Vector3(-35.31277, -580.4199, 88.71221);
                            if (sender.position.DistanceTo(pos) < 2)
                            {
                                Vector3 logpos = new Vector3(float.Parse(String.Format("" + row["PosX"])), float.Parse(String.Format("" + row["PosY"])), float.Parse(String.Format("" + row["PosZ"])));
                                API.setEntityPosition(sender, logpos);
                                API.setEntityDimension(sender, 0);
                                objplayer.dimension = 0;
                                objplayer.IsOnInt   = false;
                            }
                        }
                    }
                }
                #endregion

                #region AccesExterieurVersGarage
                DataTable accesgarage = API.exported.database.executeQueryWithResult("SELECT * FROM Garages");
                foreach (DataRow row in accesgarage.Rows)
                {
                    if (!sender.isInVehicle & sender.position.DistanceTo(new Vector3(Convert.ToDouble(row["PosX"]), Convert.ToDouble(row["PosY"]), Convert.ToDouble(row["PosZ"]))) < 2)
                    {
                        API.triggerClientEvent(sender, "MenuExtToGarage");
                        return;
                    }
                }
                #endregion
            }
        }