Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release No ammo for secondary
#1
Rainbow 
Hey,

Made by request.
No ammo for secondary weapon. ( Useful for sniper servers ).

SOURCE
Code:
using Addon;
using System.Collections.Generic;
namespace noammo
{
    public class noammos : CPlugin
    {
        public override void OnAddonFrame()
        {
           // to prevent errors
            List<ServerClient> clients = new List<ServerClient>();
            if (clients != null && clients.Count > 0)
            {
                foreach (ServerClient cl in GetClients())
                {
                    if (cl != null)
                    {
                        cl.Ammo.SecondaryAkimboAmmo = 0;
                        cl.Ammo.SecondaryAmmo = 0;
                        cl.Ammo.SecondaryAmmoClip = 0;
                    }
                }
            }
        }
    }

}

.zip   noammo.zip (Size: 1.84 KB / Downloads: 86)

Credits:
@jaydi - coded
@ALEXFDR - idea
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#2
(09-08-2012, 23:27)JayDi Wrote: Hey,

Made by request.
No ammo for secondary weapon. ( Useful for sniper servers ).
Credits:
@jaydi - coded
@ALEXFDR - idea

it didn't work, sry, btw i coped the game folder into my desktop and opened the server but it doesnt show on the server list, is it because i copied the folder or because something else.

tkx in advance.
Reply

#3
How could it not? The code is flawless.
You did put the plugin inside your addon folder? And are you using the lastest MW3 Server Addon, the one updated by @zxz0O0
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
Reply

#4
Ohh my fault i compiled that in net 4.0
I will re-upload now.
Sorry.

EDIT: It's fine now.
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#5
[Image: azuw.jpg]
Reply

#6
(09-08-2012, 23:27)JayDi Wrote:
Code:
List<ServerClient> clients = new List<ServerClient>();
            if (clients != null && clients.Count > 0)
To prevent what error also as pointed out by @zxz0O0 it will never execute
Reply

#7
It will give error like "Object is undefined".
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#8
I will say the whole code is messed, try this
CSHARP Code
  1. using Addon;
  2. using System.Collections.Generic;
  3.  
  4. namespace nope
  5. {
  6. public class Class1:CPlugin
  7. {
  8. public override void OnPlayerSpawned(ServerClient cl)
  9. {
  10. if(cl.Other.SecondaryWeaponAkimbo == true)
  11. cl.Ammo.SecondaryAkimboAmmo = 0;
  12. cl.Ammo.SecondaryAmmo = 0;
  13. cl.Ammo.SecondaryAmmoClip = 0;
  14. }
  15. }
  16. }

If no-one has ammo on spawn, they won't have it ever
Reply

#9
(09-09-2012, 13:43)archit Wrote: I will say the whole code is messed, try this
CSHARP Code
  1. using Addon;
  2. using System.Collections.Generic;
  3.  
  4. namespace nope
  5. {
  6. public class Class1:CPlugin
  7. {
  8. public override void OnPlayerSpawned(ServerClient cl)
  9. {
  10. if(cl.Other.SecondaryWeaponAkimbo == true)
  11. cl.Ammo.SecondaryAkimboAmmo = 0;
  12. cl.Ammo.SecondaryAmmo = 0;
  13. cl.Ammo.SecondaryAmmoClip = 0;
  14. }
  15. }
  16. }

If no-one has ammo on spawn, they won't have it ever

What if player will pick ammo?
Also my code is working. I tested it.
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#10
No one ever had secondary weapon ammo,how will someone drop it so he can pick it?
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Request] no ammo for infected gamemode ExoGamer* 8 5,547 08-15-2013, 18:59
Last Post: Dr3am95
  Help Receiving a random primary & secondary DidUknowiPwn 5 4,398 07-22-2013, 09:47
Last Post: Yamato
  M320 and GP25 ammo McKinleySPB 3 3,077 07-06-2013, 12:56
Last Post: archit
Smile [Release] Unlimited ammo v2.3 & @Nukems unlammo hillbilly 40 23,993 06-26-2013, 11:33
Last Post: X-Track
Question can't find it (ammo box) DJSKilly 8 5,265 05-29-2013, 11:27
Last Post: Dr3am95
Wink Help Ammo box Dr3am95 6 4,398 03-31-2013, 15:39
Last Post: NyZzE
  Help Problem unlimited ammo plugin 4nonymous 2 3,107 03-10-2013, 20:14
Last Post: hillbilly
Smile Need Someone to Make an Ammo Replenishing Box SkATerJoN 5 3,959 01-18-2013, 17:31
Last Post: tomglazer
  Help Setting ammo for M320/Shotgun Attachment yokai134 2 2,797 12-12-2012, 07:03
Last Post: yokai134
  [Request] im looking for ammo code pap12322221112 2 2,509 10-22-2012, 08:41
Last Post: AZUMIKKEL

Forum Jump:


Users browsing this thread:
1 Guest(s)

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