• 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release [Code] Akimbo weapon fix (new)
#1
Rainbow 
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:
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);
        }
    }
}
C++/Obj-C developer. Neko engine wip
Steam: Click
[-] The following 6 users say Thank You to Nekochan for this post:
  • 8q4s8, 99IRock, ltybcs, NyZzE, surtek, zuiopas1
  Reply
#2
If you switch from akimbo weapon to ump45 game will crash ( not server ), but you can fix it by adding some code.

Also pp90m1 crash the client.
Anyway thanks so much Smile
[Image: b_560_95_1.png]
[Image: hax0r3ez.gif]
  Reply
#3
It works! Big, huge thanks for this fix!
  Reply
#4
super

Rolleyes
Idea
Tongue
  Reply
#5
@master131 , maybe you'll add this to addon extensions?

You can remove
Code:
ServerClient Client = c;
I was lazy to replace 'Client' variable Meow
C++/Obj-C developer. Neko engine wip
Steam: Click
[-] The following 1 user says Thank You to Nekochan for this post:
  • NyZzE
  Reply
#6
Oooom sry! when i copied your source code to visual studio (with addon reference) it gives me many errors!
c.ConnectionState
ConnectionStates
c.Other
Client.Other.CurrentWeapon == GetWeapon
Client.Other
how to solve it!?
  Reply
#7
(02-24-2013, 23:47)mn_acer1 Wrote: Oooom sry! when i copied your source code to visual studio (with addon reference) it gives me many errors!
c.ConnectionState
ConnectionStates
c.Other
Client.Other.CurrentWeapon == GetWeapon
Client.Other
how to solve it!?


Can you copy the errors and paste them here, so we can help you to fix it Smile
[Image: b_560_95_1.png]
[Image: hax0r3ez.gif]
  Reply
#8
(02-24-2013, 23:58)99IRock Wrote:
(02-24-2013, 23:47)mn_acer1 Wrote: Oooom sry! when i copied your source code to visual studio (with addon reference) it gives me many errors!
c.ConnectionState
ConnectionStates
c.Other
Client.Other.CurrentWeapon == GetWeapon
Client.Other
how to solve it!?


Can you copy the errors and paste them here, so we can help you to fix it Smile
thanks it's solved by this addon http://www.itsmods.com/forum/attachment.php?aid=2159
the problems gone now! Smile
it seems i had older addon version!
i gotta take a look at this addon and see what it can does! Tongue
  Reply
#9
@tubwux request for this plugin. here u go Smile


Attached Files
.rar   akimbo_fix.rar (Size: 2.17 KB / Downloads: 27)
  Reply
#10
(02-27-2013, 16:35)EnVi Sweden Rocks Wrote: @tubwux request for this plugin. here u go Smile

Thaaakkkk yoooouuuuu
[-] The following 1 user says Thank You to tubwux for this post:
  • EnVi Sweden Rocks
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
Question Help Mw2 weapon skin question FroxIVx4 1 1,466 10-13-2013, 16:54
Last Post: hmann
Question Help Weapon Name iRoNinja 8 2,981 10-08-2013, 08:31
Last Post: iRoNinja
  Help Code color crosshairs koren30 3 1,917 10-02-2013, 19:26
Last Post: koren30
  Mw2 weapon porting? Cuddlyedits 3 2,070 09-15-2013, 16:43
Last Post: DidUknowiPwn
Rainbow [Release] MW3: Random Weapon Plugin V1 Nekochan 50 16,745 09-11-2013, 15:11
Last Post: EnVi Sweden Rocks
  Help need help?how to make plugins code hXnarutoXone 12 3,838 09-01-2013, 18:30
Last Post: Bandarigoda123
  Help Need Help with C# code tubwux 2 1,639 08-27-2013, 18:18
Last Post: tubwux
  [Request] Compile this code please dozsa0 4 1,996 08-10-2013, 21:02
Last Post: Nukem
  Compile this code please First_Semyon 12 4,386 08-08-2013, 14:53
Last Post: Bandarigoda123
  Compile please this code First_Semyon 8 2,638 07-28-2013, 01:52
Last Post: First_Semyon

Forum Jump:


Users browsing this thread: 1 Guest(s)