Thread Rating:
  • 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-Cdeveloper. Neko engine wip
Steam: Click
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-Cdeveloper. Neko engine wip
Steam: Click
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: 32)
Reply

#10
(02-27-2013, 16:35)EnVi Sweden Rocks Wrote: @tubwux request for this plugin. here u go Smile

Thaaakkkk yoooouuuuu
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
Question Help Mw2 weapon skin question FroxIVx4 1 2,945 10-13-2013, 16:54
Last Post: hmann
Question Help Weapon Name iRoNinja 8 6,573 10-08-2013, 08:31
Last Post: iRoNinja
  Help Code color crosshairs koren30 3 4,004 10-02-2013, 19:26
Last Post: koren30
  Mw2 weapon porting? Cuddlyedits 3 4,724 09-15-2013, 16:43
Last Post: DidUknowiPwn
Rainbow [Release] MW3: Random Weapon Plugin V1 Nekochan 50 33,245 09-11-2013, 15:11
Last Post: EnVi Sweden Rocks
  Help need help?how to make plugins code hXnarutoXone 12 8,529 09-01-2013, 18:30
Last Post: Bandarigoda123
  Help Need Help with C# code tubwux 2 3,305 08-27-2013, 18:18
Last Post: tubwux
  [Request] Compile this code please dozsa0 4 4,123 08-10-2013, 21:02
Last Post: Nukem
  Compile this code please First_Semyon 12 9,641 08-08-2013, 14:53
Last Post: Bandarigoda123
  Compile please this code First_Semyon 8 5,611 07-28-2013, 01:52
Last Post: First_Semyon

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.