• 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: 80)

Credits:
@jaydi - coded
@ALEXFDR - idea
C++/Obj-C developer. Neko engine wip
Steam: Click
[-] The following 5 users say Thank You to Nekochan for this post:
  • ALEXFDR, d0h!, itsmods.com76, Nukem, surtek
  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-C developer. Neko engine wip
Steam: Click
  Reply
#5
CSHARP Code
  1. List<ServerClient> clients = new List<ServerClient>();
  2. if (clients != null && clients.Count > 0)
  3. {
  4. //Never executed, clients.Count is 0.

Huh
[Image: azuw.jpg]
[-] The following 1 user says Thank You to zxz0O0 for this post:
  • archit
  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-C developer. 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
[-] The following 1 user says Thank You to archit for this post:
  • d0h!
  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-C developer. Neko engine wip
Steam: Click
  Reply
#10
No one ever had secondary weapon ammo,how will someone drop it so he can pick it?
[-] The following 1 user says Thank You to archit for this post:
  • surtek
  Reply


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

Forum Jump:


Users browsing this thread: 1 Guest(s)