Hey,
I just found my old code, i tested it. Works fine.
Known bug:
If you switch from akimbo weapon to ump45 game will crash ( not server ), but you can fix it by adding some code.
How it works?
Simple. Just disables akimbo/enables on weapon switch.
Video:
I'll upload soon.
Note: replace ak47 by another weapon or just add more.
Give me credits if you're using it.
Credits:
@sailormoon - coded
Source:
I just found my old code, i tested it. Works fine.
Known bug:
If you switch from akimbo weapon to ump45 game will crash ( not server ), but you can fix it by adding some code.
How it works?
Simple. Just disables akimbo/enables on weapon switch.
Video:
I'll upload soon.
Note: replace ak47 by another weapon or just add more.
Give me credits if you're using it.
Credits:
@sailormoon - coded
Source:
Code:
using System.Collections.Generic;
using System.IO;
using Addon;
namespace AkimboFix
{
public class CMain : CPlugin
{
public override void OnAddonFrame()
{
List<ServerClient> clients;
clients = GetClients();
if (clients != null)
{
foreach (ServerClient c in clients)
{
if (c.ConnectionState != ConnectionStates.MapLoading &&
c.ConnectionState != ConnectionStates.Connecting &&
c.ConnectionState != ConnectionStates.Zombie)
{
ServerClient Client = c;
if (c.Other.isAlive)
{
if (Client.Other.CurrentWeapon == GetWeapon("iw5_ak47_mp"))
{
Client.Other.PrimaryWeaponAkimbo = true;
Client.Other.SecondaryWeaponAkimbo = true;
}
else
{
Client.Other.PrimaryWeaponAkimbo = false;
Client.Other.SecondaryWeaponAkimbo = false;
}
}
else
{
Client.Other.PrimaryWeaponAkimbo = false;
Client.Other.SecondaryWeaponAkimbo = false;
}
}
}
}
}
public override ChatType OnSay(string Message, ServerClient Client, bool Teamchat)
{
if (Message == "!s")
{
// give ak 47 as test
Client.Other.PrimaryWeapon = GetWeapon("iw5_ak47_mp");
// Client.Other.CurrentWeapon = GetWeapon("iw5_ak47_mp_camo02");
}
return base.OnSay(Message, Client, Teamchat);
}
public override void OnPlayerChangeWeapon(ServerClient Client, int WeaponID)
{
if (Client.Other.CurrentWeapon != GetWeapon("iw5_ak47_mp"))
{
Client.Other.CurrentWeaponAkimbo = false;
Client.Other.PrimaryWeaponAkimbo = false;
Client.Other.SecondaryWeaponAkimbo = false;
Client.Other.WeaponSlot3Akimbo = false;
Client.Other.WeaponSlot4Akimbo = false;
Client.Other.WeaponSlot5Akimbo = false;
Client.Other.WeaponSlot6Akimbo = false;
}
base.OnPlayerChangeWeapon(Client, WeaponID);
}
}
}