diff --git a/gamedata/Cs2Jailbreak.json b/gamedata/Cs2Jailbreak.json new file mode 100644 index 0000000..23f33a3 --- /dev/null +++ b/gamedata/Cs2Jailbreak.json @@ -0,0 +1,9 @@ +{ + "CBasePlayerController_SetPawn": { + "signatures": { + "library": "server", + "windows": "\\x44\\x88\\x4C\\x24\\x2A\\x55\\x57", + "linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x41\\x54\\x49\\x89\\xFC\\x53\\x48\\x89\\xF3\\x48\\x81\\xEC\\xC8\\x00\\x00\\x00" + } + } +} \ No newline at end of file diff --git a/src/LastRequest/Rebel.cs b/src/LastRequest/Rebel.cs index 573e36d..6974fc4 100644 --- a/src/LastRequest/Rebel.cs +++ b/src/LastRequest/Rebel.cs @@ -40,7 +40,7 @@ public void rebel_guns(CCSPlayerController player, ChatMenuOption option) player.strip_weapons(); - player.GiveNamedItem("weapon_" + Lib.gun_give_name(option.Text)); + player.GiveNamedItem(Lib.gun_give_name(option.Text)); player.GiveNamedItem("weapon_deagle"); player.GiveNamedItem("item_assaultsuit"); diff --git a/src/Lib.cs b/src/Lib.cs index c90dc01..fc85de9 100644 --- a/src/Lib.cs +++ b/src/Lib.cs @@ -687,10 +687,10 @@ static void give_menu_weapon(CCSPlayerController player, ChatMenuOption option) player.strip_weapons(); // give their desired guns with lots of reserve ammo - player.GiveNamedItem("weapon_" + gun_give_name(option.Text)); + player.GiveNamedItem(gun_give_name(option.Text)); player.GiveNamedItem("weapon_deagle"); - CBasePlayerWeapon? primary = Lib.find_weapon(player,gun_give_name(option.Text)); + CBasePlayerWeapon? primary = Lib.find_weapon(player,GUN_LIST[option.Text]); primary.set_ammo(-1,999); CBasePlayerWeapon? secondary = Lib.find_weapon(player,"deagle"); @@ -699,35 +699,27 @@ static void give_menu_weapon(CCSPlayerController player, ChatMenuOption option) player.GiveNamedItem("item_assaultsuit"); } - static String[] GUN_LIST = - { - "ak47", "m4a1_silencer","nova", - "p90", "m249", "mp5sd", - "galilar", "sg556","bizon", "aug", - "famas", "xm1014","ssg08","awp" - - }; - - static String[] GUN_NAMES = - { - "AK47","M4","M3","P90","M249","MP5", - "FAL","SG556","BIZON","AUG", - "FAMAS","XM1014","SCOUT","AWP" + static Dictionary GUN_LIST = new Dictionary() + { + {"AK47","ak47"}, + {"M4","m4a1_silencer"}, + {"M3","nova"}, + {"P90","p90"}, + {"M249","m249"}, + {"MP5","mp5sd"}, + {"FAL","galilar"}, + {"SG556","sg556"}, + {"BIZON","bizon"}, + {"AUG","aug"}, + {"FAMAS","famas"}, + {"XM1014","xm1014"}, + {"SCOUT","ssg08"}, + {"AWP", "awp"}, }; - public static String gun_give_name(String name) { - // TODO: a linear scan shouldn't matter on a list this small - for(int i = 0; i < GUN_NAMES.Count(); i++) - { - if(name == GUN_NAMES[i]) - { - return GUN_LIST[i]; - } - } - - return ""; + return "weapon_" + GUN_LIST[name]; } static public void gun_menu_internal(this CCSPlayerController? player, bool no_awp, Action callback) @@ -741,8 +733,10 @@ static public void gun_menu_internal(this CCSPlayerController? player, bool no_a var gun_menu = new ChatMenu("Gun Menu"); - foreach(var weapon_name in GUN_NAMES) + foreach(var weapon_pair in GUN_LIST) { + var weapon_name = weapon_pair.Key; + if(no_awp && weapon_name == "awp") { continue; diff --git a/src/Warden/Warden.cs b/src/Warden/Warden.cs index be0c529..f5e8fef 100644 --- a/src/Warden/Warden.cs +++ b/src/Warden/Warden.cs @@ -439,7 +439,7 @@ public void setup_player_guns(CCSPlayerController? player) if(jail_player != null) { - player.GiveNamedItem("weapon_" + Lib.gun_give_name(jail_player.ct_gun)); + player.GiveNamedItem(Lib.gun_give_name(jail_player.ct_gun)); } } @@ -541,7 +541,7 @@ public void ct_guns(CCSPlayerController player, ChatMenuOption option) jail_player.ct_gun = option.Text; } - player.GiveNamedItem("weapon_" + Lib.gun_give_name(option.Text)); + player.GiveNamedItem(Lib.gun_give_name(option.Text)); player.GiveNamedItem("weapon_deagle"); if(config.ct_armour)