C#:
using GTANetworkAPI;
using System;
using System.Collections.Generic;
using NeptuneEvo.GUI;
using NeptuneEvo.Core;
using NeptuneEvo.Players.Models;
using NeptuneEvo.Players;
using Redage.SDK;
namespace NeptuneEvo.Jobs
{
class GarbageTruck : Script
{
private static Dictionary<Player, Vehicle> playerVehicles = new Dictionary<Player, Vehicle>();
[RemoteEvent("SERVER:WORK:START")]
public static void GarbageTruckStartWork(Player player)
{
// Создаем машину
Vehicle veh = NAPI.Vehicle.CreateVehicle(VehicleHash.Boxville3, new Vector3(151.42921, -1520.209, 29.35597), -38, 0, 0, "Truck");
NAPI.Data.SetEntityData(veh, "ACCESS", "WORK");
NAPI.Data.SetEntityData(veh, "NUMBER", "Truck");
NAPI.Data.SetEntityData(veh, "ON_WORK", true);
NAPI.Data.SetEntityData(veh, "DRIVER", null);
veh.SetSharedData("PETROL", VehicleManager.VehicleTank[veh.Class]);
// Секрет для машины игрока
playerVehicles[player] = veh;
}
[RemoteEvent("SERVER:WORK:END")]
public static void GarbageTruckEndWork(Player player)
{
if (playerVehicles.ContainsKey(player))
{
Vehicle veh = playerVehicles[player];
NAPI.Data.SetEntityData(veh, "ACCESS", "WORK");
NAPI.Data.SetEntityData(veh, "NUMBER", "Truck");
NAPI.Data.SetEntityData(veh, "ON_WORK", false);
NAPI.Data.SetEntityData(veh, "DRIVER", null);
veh.Delete();
playerVehicles.Remove(player);
}
}
[RemoteEvent("WORK:GARBAGE:SET:MONEY")]
public static void GarbageTruckWorkPay(GTANetworkAPI.Player player, int amount)
{
var extPlayer = player as NeptuneEvo.Handles.ExtPlayer; // or some conversion method
if (extPlayer != null)
{
extPlayer.SendNotification("Вы получили " + amount + " за собранный мусор!");
MoneySystem.Wallet.Change(extPlayer, amount);
}
else
{
// Handle the case where conversion is not possible
}
}
}
}
Все работает, когда машина заводится, не могу сесть в машину. Я не понимал, что делать
Можете ли вы помочь?