Results 1 to 7 of 7

Threaded View

  1. #1
    Kenshin13's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Cloud 9
    Posts
    3,470
    Reputation
    564
    Thanks
    6,168
    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-11-2012 at 11:29 PM.

  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-17-2015),mwxplayer (11-12-2012),samio1997 (11-16-2012),SLiiTH3R (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, 07:18 PM
  2. How to make a runescape private server
    By Pixie in forum RuneScape Discussions
    Replies: 55
    Last Post: 11-23-2010, 01: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, 03: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, 08: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, 01:01 PM