Bumsnudel Posted September 13, 2018 Share Posted September 13, 2018 Hallo Leute, ich habe in meinem Code folgende Zeile implementiert: [Command("addmod")] public void AddVehicleModCommand(Vehicle vehicle, int modType, int mod) { NAPI.Vehicle.SetVehicleMod(vehicle, modType, mod); } Wenn ich nun Ingame: z.B "/addmod 69 2" (zur Scheibentönung) in die Console eingebe bringt er im Server-Fenster folgenden Fehler: UNHANDLED EXCEPTION IN COMMAND addmod FOR RESOURCE GTANFreeroam System.ArgumentException: Object of type 'GTANetworkAPI.Client' cannot be converted to type 'GTANetworkAPI.Vehicle'. at object RuntimeType.TryChangeType(object value, Binder binder, CultureInfo culture, bool needsSpecialCast) at object[] System.Reflection.MethodBase.CheckArguments(object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig) at object[] System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) at object System.Reflection.RuntimeMethodInfo.Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) at bool GTANetworkInternals.CommandParser.Parse(Client sender, string cmdRaw, string ourcmd, string[] args) in C:\Users\Adam\Documents\Git\comp-layer2\BootstrapperNC\Handlers\CommandHandler.cs:line 246 Kann mir jemand helfen worum es sich handelt und wie ich den Error weg bekomme. LG Link to comment Share on other sites More sharing options...
linnik Posted September 13, 2018 Share Posted September 13, 2018 I suppose it will be fixed in 0.4 which is never come out. Link to comment Share on other sites More sharing options...
Larvell Posted September 13, 2018 Share Posted September 13, 2018 vermutlich musst du ihm sagen welches fahrzeug. also das in dem du sitzt. NAPI.Vehicle.SetVehicleMod(NAPI.Player.GetPlayerVehicle(vehicle), modType, mod); bei unserem developmentmenü funktioniert es Link to comment Share on other sites More sharing options...
Whooza Posted September 14, 2018 Share Posted September 14, 2018 (edited) Edited April 9, 2019 by Whooza refactoring Link to comment Share on other sites More sharing options...
m4a_X Posted September 14, 2018 Share Posted September 14, 2018 Dein Problem zu beschreiben, du musst bei einem Befehl immer zu erst den Spieler angeben sprich anstatt public void AddVehicleModCommand(Vehicle vehicle, int modType, int mod) machst du public void AddVehicleModCommand(Client player, Vehicle vehicle, int modType, int mod) Link to comment Share on other sites More sharing options...
Recommended Posts