Results 1 to 7 of 7
  1. #1
    Kenshin13's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Cloud 9
    Posts
    3,473
    Reputation
    564
    Thanks
    5,885
    My Mood
    Psychedelic

    :: IW5M :: - :: How To Make An Unlimited Ammo Server ::

    Simply because I was so bored, I decided to show you guys this for those who didn't know.
    Visual C# is required and you must have some basic knowledge of the language.

    Ok so make a new C# project. Class Library is our thing and .NET Framework's gonna be 4.0 so go ahead and select that. Type in your project's name etc.
    Before we continue, let's add the InfinityScript.dll to the references now:

    Solution Navigator -> References -> Right Click -> Add Reference -> File Name -> Browse -> Select "InfinityScript.dll" -> Add -> Close.

    Now you should see pretty empty looking code..
    We now need to include it in our file. So we use "using InfinityScript;" at the top of the file where all the "using"s are.

    So your file should look like thisOr somewhat close)


    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System. IO;
    using InfinityScript;
    using System.Text.RegularExpressions;
    using System.Collections;
    using System.Runtime.InteropServices;
    Obviously I added some stuff...So you may add them too.
    Ok now this little code:


    Code:
    namespace YourProjectNameHere
    {
      public class Class1
      {
      }
    }
    Oh lovely. Now let's make it ugly
    We gotta inherit from BaseScript (just as when we used Nukem's addon we inherited from CPlugin)

    Sooo....


    Code:
    namespace UnlimitedAmmo
    {
        public class Unlimited_Ammo : BaseScript
        {
        }
    }
    We're gonna get dirty with our class now. (Sex pun? Or is my mind really that immature?)
    We're gonna add a little check for the player name and a function to add the ammo to a player, which from here-on-out will be referred to an "Entity" inside our class.
    So now we create a list and a function as follows:


    Code:
    //Create a list to store the player names.
    public List<string> EntityReturn = new List<string>();
    I just realized I need to further explain the following code.
    Ok so in InfinityScript there's a class called "Entity" which basically holds the player's data. Now an "Entity" can not only refer to players alone but objects as well. If you ever dug around in source code for ESPs or Aimbots you'd see they have entities too.
    So now we can create a function which holds an entity like so:


    Code:
    //Making a boolean function, can be anything but for this case, we'll use bool.
    //The parameters are in the format Entity ThePlayer, int AmountOfAmmoTOSetToPlayer.
    public bool SetAmmo(Entity player, int amtOfAmmo)
    {
        //Remember the list we created earlier? Here's where we check if a false entity was passed. We check the name against null.
        if(EntityReturn.Contains(player.GetField<string>("name")))
            return false;
        //Now let's set up the ammo adding. Remember our passed entity's name is "player"
        //Let's get the current and offhand ammo for unlimited grenades also.
        var Currwep = player.CurrentWeapon;
        var offhandAmmo = player.Call<string>("getcurrentoffhand");
        //Now we'll use the "Call" operator to set the ammo amount we passed to the offhand ammo.
        player.Call("setweaponammoclip", offhandAmmo, amtOfAmmo);
        player.Call("givemaxammo", offhandAmmo);
        //Now the same for the current weapon:
        player.Call("setweaponammoclip", Currwep, amtOfAmmo);
        player.Call("setweaponammoclip", Currwep, amtOfAmmo, "left");
        player.Call("setweaponammoclip", Currwep, amtOfAmmo, "right");
        //And we return true to indicate the operation was sucessful
        return true;
    }
    Awesome now we gotta actually set the ammo as a player is spawed right?
    To do this we use an awesome little setup InfinityScript uses. We call a certain part of the program as it loads.


    This is the format:

    Code:
    public ClassName() : base
    So we add this to the class (Well for my class, change yours to the class name:

    Code:
        public Unlimited_Ammo() : base
        {
            //So here's where we check is a player has connected and create a new action to do as they are. Gotta love threads right? :P
           //It's gonna take the Entity(player) as it's parameter and do a specific action on that entity.
           PlayerConnected += new Action<Entity>(PLAYERx =>
           {
               //Here's where we do the action, ik it looks weird but you'll learn to love it. We add another action that happens when they're spawned
               PLAYERx.SpawnedPlayer += new Action(() =>
               {
                       //We'll use OnInterval which creates a thread that executes ever X ms on the player
                       OnInterval(10, () => SetAmmo(PLAYERx, 99));
                //Close the braces now.
                });
              //Final brace
            }
            //Now close the method
         }
    And that's it! Your code should fully compile now. Add it the the "scripts" folder and it will auto-execute every time you start your server!

    Credits: DidUKnowiPwn
    Last edited by Kenshin13; 11-12-2012 at 12:29 AM.

  2. The Following 7 Users Say Thank You to Kenshin13 For This Useful Post:

    -GodOfWar- (11-12-2012),hacktaodachethet (11-19-2012),MKENYON401 (01-11-2013),montyx (01-18-2015),mwxplayer (11-12-2012),samio1997 (11-16-2012),SLiiTH3R (01-10-2013)

  3. #2
    gauthier08's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Posts
    147
    Reputation
    10
    Thanks
    10
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using InfinityScript;
    using System.Text.RegularExpressions;
    using System.Collections;
    using System.Runtime.InteropServices;
    
    namespace Ammo
    {
        public class Ammo : BaseScript
        {
            public List<string> EntityReturn = new List<string>();
        }
    
        {<< THIS ONE IS GIVVING ME A ERROR, a namespace cannot directly contain such as field or methots
        //Remember the list we created earlier? Here's where we check if a false entity was passed. We check the name against null.
        if(EntityReturn.Contains(player.GetField<string>("name")))
            return false;
        //Now let's set up the ammo adding. Remember our passed entity's name is "player"
        //Let's get the current and offhand ammo for unlimited grenades also.
        var Currwep = player.CurrentWeapon;
        var offhandAmmo = player.Call<string>("getcurrentoffhand");
        //Now we'll use the "Call" operator to set the ammo amount we passed to the offhand ammo.
        player.Call("setweaponammoclip", offhandAmmo, amtOfAmmo);
        player.Call("givemaxammo", offhandAmmo);
        //Now the same for the current weapon:
        player.Call("setweaponammoclip", Currwep, amtOfAmmo);
        player.Call("setweaponammoclip", Currwep, amtOfAmmo, "left");
        player.Call("setweaponammoclip", Currwep, amtOfAmmo, "right");
        //And we return true to indicate the operation was sucessful
        return true;
        }
    Lolz, my code is now this (not yet done)
    but look good, i make my error big and typed the reason what it says
    help please

  4. #3
    mwxplayer's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    hax
    Posts
    584
    Reputation
    10
    Thanks
    2,666
    My Mood
    Doh
    Quote Originally Posted by gauthier08 View Post
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using InfinityScript;
    using System.Text.RegularExpressions;
    using System.Collections;
    using System.Runtime.InteropServices;
    
    namespace Ammo
    {
        public class Ammo : BaseScript
        {
            public List<string> EntityReturn = new List<string>();
        }
    
        {<< THIS ONE IS GIVVING ME A ERROR, a namespace cannot directly contain such as field or methots
        //Remember the list we created earlier? Here's where we check if a false entity was passed. We check the name against null.
        if(EntityReturn.Contains(player.GetField<string>("name")))
            return false;
        //Now let's set up the ammo adding. Remember our passed entity's name is "player"
        //Let's get the current and offhand ammo for unlimited grenades also.
        var Currwep = player.CurrentWeapon;
        var offhandAmmo = player.Call<string>("getcurrentoffhand");
        //Now we'll use the "Call" operator to set the ammo amount we passed to the offhand ammo.
        player.Call("setweaponammoclip", offhandAmmo, amtOfAmmo);
        player.Call("givemaxammo", offhandAmmo);
        //Now the same for the current weapon:
        player.Call("setweaponammoclip", Currwep, amtOfAmmo);
        player.Call("setweaponammoclip", Currwep, amtOfAmmo, "left");
        player.Call("setweaponammoclip", Currwep, amtOfAmmo, "right");
        //And we return true to indicate the operation was sucessful
        return true;
        }
    Lolz, my code is now this (not yet done)
    but look good, i make my error big and typed the reason what it says
    help please
    idiot..
    you don't a constructor in the class

    ---------- Post added at 04:48 AM ---------- Previous post was at 04:43 AM ----------

    For Copy & Pasters
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using InfinityScript;
    using System****;
    
    namespace test
    {
        public class Class1 : BaseScript
        {
            public List<string> EntityReturn = new List<string>();
    
            
            public bool SetAmmo(Entity player, int amtOfAmmo)
            {
              
                if (EntityReturn.Contains(player.GetField<string>("name")))
                    return false;
               
                var Currwep = player.CurrentWeapon;
                var offhandAmmo = player.Call<string>("getcurrentoffhand");
             
                player.Call("setweaponammoclip", offhandAmmo, amtOfAmmo);
                player.Call("givemaxammo", offhandAmmo);
              
                player.Call("setweaponammoclip", Currwep, amtOfAmmo);
                player.Call("setweaponammoclip", Currwep, amtOfAmmo, "left");
                player.Call("setweaponammoclip", Currwep, amtOfAmmo, "right");
               
                return true;
            }
    
            public Class1()
            {
                 
                PlayerConnected += new Action<Entity>(PLAYERx =>
                {
                  
                    PLAYERx.SpawnedPlayer += new Action(() =>
                    {
                       
                        OnInterval(10, () => SetAmmo(PLAYERx, 99));
                       
                    });
                   
                });
    
    
            }
        }
    }

  5. #4
    gauthier08's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Posts
    147
    Reputation
    10
    Thanks
    10
    Srry, lol i JUST got C#,
    And im just 12years old. Like you can do everything just you got c#/c++
    But thanks for reply!

  6. #5
    LaggSpike's Avatar
    Join Date
    Apr 2011
    Gender
    male
    Posts
    123
    Reputation
    12
    Thanks
    15
    My Mood
    Cheerful
    This^ made me go all

  7. #6
    Kenshin13's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Cloud 9
    Posts
    3,473
    Reputation
    564
    Thanks
    5,885
    My Mood
    Psychedelic
    Here's the direct code for those noobs that make other noobs seem like experts:

    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System. IO;
    using InfinityScript;
    using System.Text.RegularExpressions;
    using System.Collections;
    using System.Runtime.InteropServices;
    
    namespace UnlimitedAmmo
    {
        public class Unlimited_Ammo : BaseScript
        {
             public List<string> EntityReturn = new List<string>();
             //Making a boolean function, can be anything but for this case, we'll use bool.
             //The parameters are in the format Entity ThePlayer, int AmountOfAmmoTOSetToPlayer.
         public bool SetAmmo(Entity player, int amtOfAmmo)
         {
               //Remember the list we created earlier? Here's where we check if a false entity was passed. We check the name against null.
               if(EntityReturn.Contains(player.GetField<string>("name")))
                        return false;
               //Now let's set up the ammo adding. Remember our passed entity's name is "player"
               //Let's get the current and offhand ammo for unlimited grenades also.
               var Currwep = player.CurrentWeapon;
               var offhandAmmo = player.Call<string>("getcurrentoffhand");
               //Now we'll use the "Call" operator to set the ammo amount we passed to the offhand ammo.
              player.Call("setweaponammoclip", offhandAmmo, amtOfAmmo);
              player.Call("givemaxammo", offhandAmmo);
              //Now the same for the current weapon:
              player.Call("setweaponammoclip", Currwep, amtOfAmmo);
              player.Call("setweaponammoclip", Currwep, amtOfAmmo, "left");
              player.Call("setweaponammoclip", Currwep, amtOfAmmo, "right");
             //And we return true to indicate the operation was sucessful
             return true;
        }
        public Unlimited_Ammo() : base
        {
            //So here's where we check is a player has connected and create a new action to do as they are. Gotta love threads right? :P
           //It's gonna take the Entity(player) as it's parameter and do a specific action on that entity.
           PlayerConnected += new Action<Entity>(PLAYERx =>
           {
               //Here's where we do the action, ik it looks weird but you'll learn to love it. We add another action that happens when they're spawned
               PLAYERx.SpawnedPlayer += new Action(() =>
               {
                       //We'll use OnInterval which creates a thread that executes ever X ms on the player
                       OnInterval(10, () => SetAmmo(PLAYERx, 99));
                //Close the braces now.
                });
              //Final brace
            }
            //Now close the method
         }
      }
    }
    Last edited by Kenshin13; 01-09-2013 at 06:59 PM.

  8. #7
    mwxplayer's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    hax
    Posts
    584
    Reputation
    10
    Thanks
    2,666
    My Mood
    Doh
    Quote Originally Posted by Kenshin13 View Post
    Here's the direct code for those noobs that make other noobs seem like experts:

    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System. IO;
    using InfinityScript;
    using System.Text.RegularExpressions;
    using System.Collections;
    using System.Runtime.InteropServices;
    
    namespace UnlimitedAmmo
    {
        public class Unlimited_Ammo : BaseScript
        {
             public List<string> EntityReturn = new List<string>();
             //Making a boolean function, can be anything but for this case, we'll use bool.
             //The parameters are in the format Entity ThePlayer, int AmountOfAmmoTOSetToPlayer.
         public bool SetAmmo(Entity player, int amtOfAmmo)
         {
               //Remember the list we created earlier? Here's where we check if a false entity was passed. We check the name against null.
               if(EntityReturn.Contains(player.GetField<string>("name")))
                        return false;
               //Now let's set up the ammo adding. Remember our passed entity's name is "player"
               //Let's get the current and offhand ammo for unlimited grenades also.
               var Currwep = player.CurrentWeapon;
               var offhandAmmo = player.Call<string>("getcurrentoffhand");
               //Now we'll use the "Call" operator to set the ammo amount we passed to the offhand ammo.
              player.Call("setweaponammoclip", offhandAmmo, amtOfAmmo);
              player.Call("givemaxammo", offhandAmmo);
              //Now the same for the current weapon:
              player.Call("setweaponammoclip", Currwep, amtOfAmmo);
              player.Call("setweaponammoclip", Currwep, amtOfAmmo, "left");
              player.Call("setweaponammoclip", Currwep, amtOfAmmo, "right");
             //And we return true to indicate the operation was sucessful
             return true;
        }
        public Unlimited_Ammo() : base
        {
            //So here's where we check is a player has connected and create a new action to do as they are. Gotta love threads right? :P
           //It's gonna take the Entity(player) as it's parameter and do a specific action on that entity.
           PlayerConnected += new Action<Entity>(PLAYERx =>
           {
               //Here's where we do the action, ik it looks weird but you'll learn to love it. We add another action that happens when they're spawned
               PLAYERx.SpawnedPlayer += new Action(() =>
               {
                       //We'll use OnInterval which creates a thread that executes ever X ms on the player
                       OnInterval(10, () => SetAmmo(PLAYERx, 99));
                //Close the braces now.
                });
              //Final brace
            }
            //Now close the method
         }
      }
    }
    I already posted it

  9. The Following User Says Thank You to mwxplayer For This Useful Post:

    Kenshin13 (01-10-2013)

Similar Threads

  1. [tutorial] how to make a inf ammo mod;
    By griezel32 in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 15
    Last Post: 02-04-2011, 08:18 PM
  2. How to make a runescape private server
    By Pixie in forum RuneScape Discussions
    Replies: 55
    Last Post: 11-23-2010, 02:20 PM
  3. How can i make an unlimited ammo hack?
    By higatoria in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 26
    Last Post: 08-14-2010, 04:00 PM
  4. [Tutorial] How to make your own "dedicated" Servers!
    By skankypies in forum Call of Duty Modern Warfare 2 Tutorials
    Replies: 32
    Last Post: 02-05-2010, 09:09 AM
  5. [TUT] How To Make A Maplestory Private Server, V62
    By NatureSkillz in forum MapleStory Hacks, Cheats & Trainers
    Replies: 3
    Last Post: 06-03-2009, 02:01 PM