NockyCZ / CS2-Deathmatch

Custom Deathmatch CS2 plugin (Includes custom spawnpoints, multicfg, gun selection, spawn protection, etc).
https://buymeacoffee.com/sourcefactory
73 stars 12 forks source link

Error invoking callback #25

Closed weeestar closed 8 months ago

weeestar commented 8 months ago

Error appears when I try to choose a team after joining the server

12:00:44 [EROR] (cssharp:Core) Error invoking callback
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at System.UInt16.ToString()
   at Deathmatch.DeathmatchCore.OnWeaponCanAcquire(DynamicHook hook) in C:\Users\Mates-PC\Desktop\WASD\Deathmatch\Events.cs:line 200
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at CounterStrikeSharp.API.Core.FunctionReference.<>c__DisplayClass7_0.<.ctor>b__0(fxScriptContext* context) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 105

Config files

//Deathmatch.json
{
  "Gameplay Settings": {
    "Free For All": true,
    "Custom Modes": true,
    "Random Selection Of Modes": false,
    "Map Start Custom Mode": 0,
    "New Mode Countdown": 10,
    "Check Enemies Distance": true,
    "Distance From Enemies for Respawn": 500,
    "Default Weapons": 1,
    "Switch Weapons": false,
    "Allow Buymenu": false,
    "Respawn Players After New Mode": false
  },
  "General Settings": {
    "Hide Round Seconds": false,
    "Block Radio Messages": true,
    "Remove Breakable Entities": true,
    "Remove Decals After Death": true,
    "Force Map End": false
  },
  "Sounds Settings": {
    "Weapon Cant Equip Sound": "sounds/ui/weapon_cant_buy.vsnd_c",
    "New Mode Sound": "sounds/music/3kliksphilip_01/bombtenseccount.vsnd_c"
  },
  "Custom Commands": {
    "Deatmatch Menu Commands": "dm,deathmatch",
    "Weapons Select Commands": "gun,weapon,w,g",
    "Weapons Select Shortcuts": "weapon_ak47:ak,weapon_ssg08:scout,weapon_revolver:r8,weapon_m4a1:m4a4,weapon_m4a1_silencer:m4a1s,weapon_awp:awp,weapon_usp_silencer:usp,weapon_glock:glock,weapon_deagle:deagle"
  },
  "Players Gameplay Settings": {
    "VIP_flag": "@css/vip",
    "respawn_time": 1.5,
    "VIP_respawn_time": 1.5,
    "spawn_protection_time": 1.2,
    "VIP_spawn_protection_time": 1.2,
    "reffil_ammo_kill": true,
    "VIP_reffil_ammo_kill": true,
    "reffil_ammo_headshot": true,
    "VIP_reffil_ammo_headshot": true,
    "refill_health_kill": 25,
    "VIP_refill_health_kill": 25,
    "refill_health_headshot": 50,
    "VIP_refill_health_headshot": 50
  },
  "Client Preferences": {
    "Kill Sound": {
      "Enabled": true,
      "Sound path": "sounds/ui/armsrace_kill_01.vsnd_c",
      "Default value": false,
      "Only for VIP": false
    },
    "Headshot Kill Sound": {
      "Enabled": true,
      "Sound path": "sounds/buttons/bell1.vsnd_c",
      "Default value": false,
      "Only for VIP": false
    },
    "Knife Kill Sound": {
      "Enabled": true,
      "Sound path": "sounds/ui/armsrace_final_kill_knife.vsnd_c",
      "Default value": false,
      "Only for VIP": false
    },
    "Hit Sound": {
      "Enabled": true,
      "Sound path": "sounds/ui/csgo_ui_contract_type2.vsnd_c",
      "Default value": false,
      "Only for VIP": false
    },
    "Only Headsnhot": {
      "Enabled": true,
      "Default value": false,
      "Only for VIP": false
    },
    "Hud Messages": {
      "Enabled": true,
      "Default value": true,
      "Only for VIP": false
    }
  },
  "ConfigVersion": 1
}
// Custom modes
{
   "custom_modes":{
      "0":{
         "mode_name":"Pistols Only",
         "mode_interval":330,
         "armor":1,
         "only_hs":false,
         "allow_knife_damage":true,
         "random_weapons":false,
         "allow_center_message":true,
         "center_message_text":"<font class='fontSize-l' color='orange'>Pistols Only</font>",
         "primary_weapons":[

         ],
         "secondary_weapons":[
            "weapon_usp_silencer",
            "weapon_p250",
            "weapon_glock",
            "weapon_cz75a",
            "weapon_elite",
            "weapon_fiveseven",
            "weapon_hkp2000",
            "weapon_tec9",
            "weapon_revolver",
            "weapon_deagle"
         ]
      },
      "1":{
         "mode_name":"2nd Round Buy",
         "mode_interval":330,
         "armor":2,
         "only_hs":false,
         "allow_knife_damage":true,
         "random_weapons":false,
         "allow_center_message":true,
         "center_message_text":"<font class='fontSize-l' color='orange'>2nd Round Buy</font>",
         "primary_weapons":[
            "weapon_mac10",
            "weapon_ssg08",
            "weapon_bizon",
            "weapon_mag7",
            "weapon_sawedoff",
            "weapon_nova",
            "weapon_xm1014",
            "weapon_mp5sd",
            "weapon_mp7",
            "weapon_mp9",
            "weapon_p90"
         ],
         "secondary_weapons":[
            "weapon_usp_silencer",
            "weapon_p250",
            "weapon_glock",
            "weapon_cz75a",
            "weapon_elite",
            "weapon_fiveseven",
            "weapon_hkp2000",
            "weapon_tec9",
            "weapon_revolver",
            "weapon_deagle"
         ]
      },
      "2":{
         "mode_name":"Rifles",
         "mode_interval":480,
         "armor":2,
         "only_hs":false,
         "allow_knife_damage":true,
         "random_weapons":false,
         "allow_center_message":true,
         "center_message_text":"<font class='fontSize-l' color='orange'>Rifles</font>",
         "primary_weapons":[
            "weapon_ak47",
            "weapon_m4a1",
            "weapon_m4a1_silencer",
            "weapon_aug",
            "weapon_sg556",
            "weapon_ssg08",
            "weapon_galilar",
            "weapon_awp",
            "weapon_famas"
         ],
         "secondary_weapons":[
            "weapon_usp_silencer",
            "weapon_p250",
            "weapon_glock",
            "weapon_cz75a",
            "weapon_elite",
            "weapon_fiveseven",
            "weapon_hkp2000",
            "weapon_tec9",
            "weapon_revolver",
            "weapon_deagle"
         ]
      },
      "3":{
         "mode_name":"Pistols HS-Only",
         "mode_interval":330,
         "armor":1,
         "only_hs":true,
         "allow_knife_damage":true,
         "random_weapons":false,
         "allow_center_message":true,
         "center_message_text":"<font class='fontSize-l' color='red'>Pistols HS-Only</font>",
         "primary_weapons":[

         ],
         "secondary_weapons":[
            "weapon_usp_silencer",
            "weapon_p250",
            "weapon_glock",
            "weapon_cz75a",
            "weapon_elite",
            "weapon_fiveseven",
            "weapon_hkp2000",
            "weapon_tec9",
            "weapon_revolver",
            "weapon_deagle"
         ]
      },
      "4":{
         "mode_name":"Rifles HS-Only",
         "mode_interval":330,
         "armor":2,
         "only_hs":true,
         "allow_knife_damage":true,
         "random_weapons":false,
         "allow_center_message":true,
         "center_message_text":"<font class='fontSize-l' color='red'>Rifles HS-Only</font>",
         "primary_weapons":[
            "weapon_ak47",
            "weapon_m4a1",
            "weapon_m4a1_silencer",
            "weapon_aug",
            "weapon_sg556",
            "weapon_ssg08",
            "weapon_galilar",
            "weapon_awp",
            "weapon_famas"
         ],
         "secondary_weapons":[
            "weapon_usp_silencer",
            "weapon_p250",
            "weapon_glock",
            "weapon_cz75a",
            "weapon_elite",
            "weapon_fiveseven",
            "weapon_hkp2000",
            "weapon_tec9",
            "weapon_revolver",
            "weapon_deagle"
         ]
      }
   }
}
#deathmatch_cvars.txt
sv_disable_radar 1
mp_give_player_c4 0
mp_playercashawards 0
mp_teamcashawards 0
mp_weapons_allow_zeus 0
mp_buy_allow_grenades 0
mp_max_armor 0
mp_freezetime 0
mp_death_drop_grenade 0
mp_death_drop_gun 0
mp_death_drop_healthshot 0
mp_drop_grenade_enable 0
mp_death_drop_c4 0
mp_death_drop_taser 0
mp_defuser_allocation 0
mp_solid_teammates 1
mp_weapons_allow_typecount -1
mp_hostages_max 0
mp_limitteams 0
mp_autoteambalance 0
mp_timelimit 60
weeestar commented 8 months ago

After updating to last CSS version, I got this one:

12:20:24 [EROR] (cssharp:Core) Error invoking callback
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at System.UInt16.ToString()
   at Deathmatch.DeathmatchCore.OnWeaponCanAcquire(DynamicHook hook) in C:\Users\Mates-PC\Desktop\WASD\Deathmatch\Events.cs:line 200
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at CounterStrikeSharp.API.Core.FunctionReference.<CreateWrappedCallback>b__18_0(fxScriptContext* context) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 120

Now, the server is crashing even when I just connect to the server.

NockyCZ commented 8 months ago

The plugin does not work on Windows