Ejemplo n.º 1
0
 private void OnPlayerEnterVehicle(Client player, Vehicle vehicle, sbyte seat)
 {
     if (NAPI.Data.GetEntityData(vehicle, EntityData.VEHICLE_FACTION) == Constants.JOB_FASTFOOD + Constants.MAX_FACTION_VEHICLES)
     {
         if (NAPI.Data.HasEntityData(player, EntityData.PLAYER_DELIVER_ORDER) == false && NAPI.Data.HasEntityData(player, EntityData.PLAYER_JOB_VEHICLE) == false)
         {
             NAPI.Player.WarpPlayerOutOfVehicle(player);
             NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_NOT_DELIVERING_ORDER);
         }
         else if (NAPI.Data.HasEntityData(player, EntityData.PLAYER_JOB_VEHICLE) && NAPI.Data.GetEntityData(player, EntityData.PLAYER_JOB_VEHICLE) != vehicle)
         {
             NAPI.Player.WarpPlayerOutOfVehicle(player);
             NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_NOT_YOUR_JOB_VEHICLE);
         }
         else
         {
             if (fastFoodTimerList.TryGetValue(player.Value, out Timer fastFoodTimer) == true)
             {
                 fastFoodTimer.Dispose();
                 fastFoodTimerList.Remove(player.Value);
             }
             if (NAPI.Data.HasEntityData(player, EntityData.PLAYER_JOB_VEHICLE) == false)
             {
                 int orderId = NAPI.Data.GetEntityData(player, EntityData.PLAYER_DELIVER_ORDER);
                 FastFoodOrderModel order = GetFastfoodOrderFromId(orderId);
                 Checkpoint         playerFastFoodCheckpoint = NAPI.Checkpoint.CreateCheckpoint(4, order.position, new Vector3(0.0f, 0.0f, 0.0f), 2.5f, new Color(198, 40, 40, 200));
                 NAPI.Data.SetEntityData(player, EntityData.PLAYER_JOB_CHECKPOINT, playerFastFoodCheckpoint);
                 NAPI.ClientEvent.TriggerClientEvent(player, "fastFoodDestinationCheckPoint", order.position);
                 NAPI.Data.SetEntityData(player, EntityData.PLAYER_JOB_VEHICLE, vehicle);
             }
         }
     }
 }
Ejemplo n.º 2
0
        public void OnPlayerEnterVehicle(Client player, Vehicle vehicle, sbyte seat)
        {
            if (vehicle.GetData(EntityData.VEHICLE_FACTION) == Constants.JOB_FASTFOOD + Constants.MAX_FACTION_VEHICLES)
            {
                if (player.HasData(EntityData.PLAYER_DELIVER_ORDER) == false && player.HasData(EntityData.PLAYER_JOB_VEHICLE) == false)
                {
                    player.WarpOutOfVehicle();
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.not_delivering_order);
                }
                else if (player.HasData(EntityData.PLAYER_JOB_VEHICLE) && player.GetData(EntityData.PLAYER_JOB_VEHICLE) != vehicle)
                {
                    player.WarpOutOfVehicle();
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.not_your_job_vehicle);
                }
                else
                {
                    if (fastFoodTimerList.TryGetValue(player.Value, out Timer fastFoodTimer) == true)
                    {
                        fastFoodTimer.Dispose();
                        fastFoodTimerList.Remove(player.Value);
                    }
                    if (player.HasData(EntityData.PLAYER_JOB_VEHICLE) == false)
                    {
                        int orderId = player.GetData(EntityData.PLAYER_DELIVER_ORDER);
                        FastFoodOrderModel order = GetFastfoodOrderFromId(orderId);
                        Checkpoint         playerFastFoodCheckpoint = NAPI.Checkpoint.CreateCheckpoint(4, order.position, new Vector3(0.0f, 0.0f, 0.0f), 2.5f, new Color(198, 40, 40, 200));

                        player.SetData(EntityData.PLAYER_JOB_CHECKPOINT, playerFastFoodCheckpoint);
                        player.SetData(EntityData.PLAYER_JOB_VEHICLE, vehicle);

                        player.TriggerEvent("fastFoodDestinationCheckPoint", order.position);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private FastFoodOrderModel GetFastfoodOrderFromId(int orderId)
        {
            FastFoodOrderModel order = null;

            foreach (FastFoodOrderModel orderModel in Globals.fastFoodOrderList)
            {
                if (orderModel.id == orderId)
                {
                    order = orderModel;
                    break;
                }
            }

            return(order);
        }