Exemplo n.º 1
0
 public void PlayerEnterVehicleEvent(Client player, Vehicle vehicle, sbyte seat)
 {
     if (vehicle.Model == (uint)VehicleHash.Taxi && seat == (sbyte)VehicleSeat.Driver)
     {
         // Check if the player has a taxi driver license
         if (DrivingSchool.GetPlayerLicenseStatus(player, Constants.LICENSE_TAXI) == -1)
         {
             player.WarpOutOfVehicle();
             player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_taxi_license);
         }
     }
 }
Exemplo n.º 2
0
        public void PlayerEnterVehicleEvent(Client player, Vehicle vehicle, sbyte seat)
        {
            if (vehicle.Model == (uint)VehicleHash.Taxi && seat == (sbyte)VehicleSeat.Driver)
            {
                if (DrivingSchool.GetPlayerLicenseStatus(player, Constants.LICENSE_TAXI) == -1)
                {
                    // Stop the vehicle's speedometer
                    player.TriggerEvent("removeSpeedometer");

                    player.WarpOutOfVehicle();
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_taxi_license);
                }
            }
        }
Exemplo n.º 3
0
        public void DocumentOptionSelectedEvent(Client player, int tramitation)
        {
            int money = NAPI.Data.GetEntitySharedData(player, EntityData.PLAYER_MONEY);

            switch (tramitation)
            {
            case Constants.TRAMITATE_IDENTIFICATION:
                if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_DOCUMENTATION) > 0)
                {
                    NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_PLAYER_HAS_IDENTIFICATION);
                }
                else if (money < Constants.PRICE_IDENTIFICATION)
                {
                    String message = String.Format(Messages.ERR_PLAYER_NOT_IDENTIFICATION_MONEY, Constants.PRICE_IDENTIFICATION);
                    NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + message);
                }
                else
                {
                    String message = String.Format(Messages.INF_PLAYER_HAS_INDENTIFICATION, Constants.PRICE_IDENTIFICATION);
                    NAPI.Data.SetEntitySharedData(player, EntityData.PLAYER_MONEY, money - Constants.PRICE_IDENTIFICATION);
                    NAPI.Data.SetEntityData(player, EntityData.PLAYER_DOCUMENTATION, Globals.GetTotalSeconds());
                    NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_INFO + message);
                    Database.LogPayment(player.Name, Messages.GEN_FACTION_TOWNHALL, Messages.GEN_IDENTIFICATION, Constants.PRICE_IDENTIFICATION);
                }
                break;

            case Constants.TRAMITATE_MEDICAL_INSURANCE:
                if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_MEDICAL_INSURANCE) > Globals.GetTotalSeconds())
                {
                    NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_PLAYER_HAS_MEDICAL_INSURANCE);
                }
                else if (money < Constants.PRICE_MEDICAL_INSURANCE)
                {
                    String message = String.Format(Messages.ERR_PLAYER_NOT_MEDICAL_INSURANCE_MONEY, Constants.PRICE_MEDICAL_INSURANCE);
                    NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + message);
                }
                else
                {
                    String message = String.Format(Messages.INF_PLAYER_HAS_MEDICAL_INSURANCE, Constants.PRICE_MEDICAL_INSURANCE);
                    NAPI.Data.SetEntitySharedData(player, EntityData.PLAYER_MONEY, money - Constants.PRICE_MEDICAL_INSURANCE);
                    NAPI.Data.SetEntityData(player, EntityData.PLAYER_MEDICAL_INSURANCE, Globals.GetTotalSeconds() + 1209600);
                    NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_INFO + message);
                    Database.LogPayment(player.Name, Messages.GEN_FACTION_TOWNHALL, Messages.GEN_MEDICAL_INSURANCE, Constants.PRICE_MEDICAL_INSURANCE);
                }
                break;

            case Constants.TRAMITATE_TAXI_LICENSE:
                if (DrivingSchool.GetPlayerLicenseStatus(player, Constants.LICENSE_TAXI) > 0)
                {
                    NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_PLAYER_HAS_TAXI_LICENSE);
                }
                else if (money < Constants.PRICE_TAXI_LICENSE)
                {
                    String message = String.Format(Messages.ERR_PLAYER_NOT_TAXI_LICENSE_MONEY, Constants.PRICE_TAXI_LICENSE);
                    NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + message);
                }
                else
                {
                    String message = String.Format(Messages.INF_PLAYER_HAS_TAXI_LICENSE, Constants.PRICE_TAXI_LICENSE);
                    NAPI.Data.SetEntitySharedData(player, EntityData.PLAYER_MONEY, money - Constants.PRICE_TAXI_LICENSE);
                    NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_INFO + message);
                    DrivingSchool.SetPlayerLicense(player, Constants.LICENSE_TAXI, 1);
                    Database.LogPayment(player.Name, Messages.GEN_FACTION_TOWNHALL, Messages.GEN_TAXI_LICENSE, Constants.PRICE_TAXI_LICENSE);
                }
                break;

            case Constants.TRAMITATE_FINE_LIST:
                List <FineModel> fineList = Database.LoadPlayerFines(player.Name);
                if (fineList.Count > 0)
                {
                    NAPI.ClientEvent.TriggerClientEvent(player, "showPlayerFineList", NAPI.Util.ToJson(fineList));
                }
                else
                {
                    NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_INFO + Messages.INF_PLAYER_NO_FINES);
                }
                break;
            }
        }
Exemplo n.º 4
0
        public void DocumentOptionSelectedEvent(Client player, int tramitation)
        {
            int money = player.GetSharedData(EntityData.PLAYER_MONEY);

            switch (tramitation)
            {
            case Constants.TRAMITATE_IDENTIFICATION:
                if (player.GetData(EntityData.PLAYER_DOCUMENTATION) > 0)
                {
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_has_identification);
                }
                else if (money < Constants.PRICE_IDENTIFICATION)
                {
                    string message = string.Format(ErrRes.player_not_identification_money, Constants.PRICE_IDENTIFICATION);
                    player.SendChatMessage(Constants.COLOR_ERROR + message);
                }
                else
                {
                    string message = string.Format(InfoRes.player_has_indentification, Constants.PRICE_IDENTIFICATION);
                    player.SetSharedData(EntityData.PLAYER_MONEY, money - Constants.PRICE_IDENTIFICATION);
                    player.SetData(EntityData.PLAYER_DOCUMENTATION, Globals.GetTotalSeconds());
                    player.SendChatMessage(Constants.COLOR_INFO + message);


                    Task.Factory.StartNew(() =>
                    {
                        // Log the payment made
                        Database.LogPayment(player.Name, GenRes.faction_townhall, GenRes.identification, Constants.PRICE_IDENTIFICATION);
                    });
                }
                break;

            case Constants.TRAMITATE_MEDICAL_INSURANCE:
                if (player.GetData(EntityData.PLAYER_MEDICAL_INSURANCE) > Globals.GetTotalSeconds())
                {
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_has_medical_insurance);
                }
                else if (money < Constants.PRICE_MEDICAL_INSURANCE)
                {
                    string message = string.Format(ErrRes.player_not_medical_insurance_money, Constants.PRICE_MEDICAL_INSURANCE);
                    player.SendChatMessage(Constants.COLOR_ERROR + message);
                }
                else
                {
                    string message = string.Format(InfoRes.player_has_medical_insurance, Constants.PRICE_MEDICAL_INSURANCE);
                    player.SetSharedData(EntityData.PLAYER_MONEY, money - Constants.PRICE_MEDICAL_INSURANCE);
                    player.SetData(EntityData.PLAYER_MEDICAL_INSURANCE, Globals.GetTotalSeconds() + 1209600);
                    player.SendChatMessage(Constants.COLOR_INFO + message);


                    Task.Factory.StartNew(() =>
                    {
                        // Log the payment made
                        Database.LogPayment(player.Name, GenRes.faction_townhall, GenRes.medical_insurance, Constants.PRICE_MEDICAL_INSURANCE);
                    });
                }
                break;

            case Constants.TRAMITATE_TAXI_LICENSE:
                if (DrivingSchool.GetPlayerLicenseStatus(player, Constants.LICENSE_TAXI) > 0)
                {
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_has_taxi_license);
                }
                else if (money < Constants.PRICE_TAXI_LICENSE)
                {
                    string message = string.Format(ErrRes.player_not_taxi_license_money, Constants.PRICE_TAXI_LICENSE);
                    player.SendChatMessage(Constants.COLOR_ERROR + message);
                }
                else
                {
                    string message = string.Format(InfoRes.player_has_taxi_license, Constants.PRICE_TAXI_LICENSE);
                    player.SetSharedData(EntityData.PLAYER_MONEY, money - Constants.PRICE_TAXI_LICENSE);
                    player.SendChatMessage(Constants.COLOR_INFO + message);
                    DrivingSchool.SetPlayerLicense(player, Constants.LICENSE_TAXI, 1);


                    Task.Factory.StartNew(() =>
                    {
                        // Log the payment made
                        Database.LogPayment(player.Name, GenRes.faction_townhall, GenRes.taxi_license, Constants.PRICE_TAXI_LICENSE);
                    });
                }
                break;

            case Constants.TRAMITATE_FINE_LIST:
                Task.Factory.StartNew(() =>
                {
                    List <FineModel> fineList = Database.LoadPlayerFines(player.Name);
                    if (fineList.Count > 0)
                    {
                        player.TriggerEvent("showPlayerFineList", NAPI.Util.ToJson(fineList));
                    }
                    else
                    {
                        player.SendChatMessage(Constants.COLOR_INFO + InfoRes.player_no_fines);
                    }
                });
                break;
            }
        }