Hallo allerseits, leider spreche ich kein Deutsch, ich benutze einen Übersetzer, weil ich Hilfe mit dem üblichen Skripterstellungsskript für Vector3 insgesamt benötige.
Ich habe den folgenden Fehler und der Code sieht meiner Meinung nach gut aus, ich weiß nicht, was los ist.
Dies ist von der Serverkonsole
Code
Exception has been thrown by the target of an invocation.
UNHANDLED EXCEPTION IN COMMAND veh FOR RESOURCE RPV
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.TypeLoadException: Could not load type 'GTANetworkAPI.Vector3' from assembly 'RPV, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' due to value type mismatch.
at void RPV.Komendy.AdminCommands.CMD_Veh(Player player, string vehName)
--- End of inner exception stack trace ---
at object RuntimeMethodHandle.InvokeMethod(object target, object[] arguments, Signature sig, bool constructor, bool wrapExceptions)
at object System.Reflection.RuntimeMethodInfo.Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
at bool GTANetworkInternals.CommandParser.Parse(Player sender, string cmdRaw, string ourcmd, string[] args)
Ich benutze den Booststrapper 1.1
Code
[INFO] Loading NodeJS packages...
[INFO] Starting packages...
[DONE] Server packages have been started.
Initializing Bootstrapper.dll (1.1.0.0)..
-> SERVER STARTED AT 27.12.2020 16:59:30
Unable to load acl.xml
ACLEnabled: False
Loaded 667 entries from vehicleData.json
Loading resources..
Skript command.cs
C#
using GTANetworkAPI;
using System.Globalization;
using System.IO;
using System;
namespace Script.Komendy
{
class AdminCommands : Script
{
// /veh /vehicle
[Command("veh", "Użyj: /veh [Nazwa Pojazdu]")]
public void CMD_Veh(Player player, string vehName)
{
VehicleHash hash = NAPI.Util.VehicleNameToModel(vehName);
if(hash == 0)
{
player.SendChatMessage("~r~Błąd: ~w~Niepoprawna nazwa pojazdu");
return;
}
Random random = new Random();
Vehicle vehicle = NAPI.Vehicle.CreateVehicle(hash, player.Position.Around(5), player.Rotation.X, random.Next(160), random.Next(160));
player.SendChatMessage($"Info: ~w~Stworzyłeś pojazd {vehicle.DisplayName}");
}
[Command("save", "Użyj /save [nazwa]", GreedyArg = true)]
public void CMD_SavePosition(Player player, string PosName = "Bez nazwy")
{
var pos = (player.IsInVehicle) ? player.Vehicle.Position : player.Position;
var rot = (player.IsInVehicle) ? player.Vehicle.Rotation : player.Rotation;
using (var stream = File.AppendText("SavePos.txt"))
{
if (player.IsInVehicle)
{
NAPI.Notification.SendNotificationToPlayer(player, "~g~W pojeździe ~w~pozycja zapisana z nazwą ~r~" + PosName, true);
stream.WriteLine("IN VEH || " + PosName + ":" + pos.X + ", " + pos.Y + ", " + pos.Z + " Rot: " + rot.Z);
stream.Close();
}
else
{
NAPI.Notification.SendNotificationToPlayer(player, "~g~Bez Auta ~w~pozycja zapisana z nazwą ~r~" + PosName, true);
stream.WriteLine("ON FOOT|| " + PosName + ":" + pos.X + ", " + pos.Y + ", " + pos.Z + " Rot: " + rot.Z);
stream.Close();
}
}
}
}
}
Alles anzeigen