This plugin gives ammo to whoever calls it ,requested by Kasperle.
Format:
!giveammo option ammo
Options:
Example
wil give 200 ammo to player archit
will give 45 ammo to everyone on server
will give 65 ammo to whoever types this
Credits:
@Kasperle
@surtek
Format:
!giveammo option ammo
Options:
- all-Gives the designated ammo to everybody on the server
- me-Gives ammo to its caller
- [name] - Name of the person whom to give without the []
Example
Code:
!giveammo archit 200Code:
!giveammo all 45Code:
!giveammo me 65Credits:
@Kasperle
@surtek
Code:
using System;
using System.Collections.Generic;
using System.Text;
using Addon;
namespace giveammo
{
public class Class1:CPlugin
{
public override void OnServerLoad()
{
ServerPrint("Give Ammo plugin loaded!");
}
public override ChatType OnSay(string Message, ServerClient Client, bool Teamchat)
{
if (Message.ToLower().StartsWith("!giveammo"))
{
string[] options = Message.Split(' ');
if (options.Length != 3)
{
TellClient(Client.ClientNum, "^2GiveAmmo: ^4Wrong options try again", true);
TellClient(Client.ClientNum, "^2GiveAmmo: ^4Format:!giveammo [playername] [ammo]", true);
}
else
{
string name = options[1];
string ammo = options[2];
if (name.ToLower() == "me")
{
Client.Ammo.PrimaryAmmo += Convert.ToInt32(ammo);
Client.Ammo.PrimaryAmmoClip += GetWeaponClipSize(Client.Other.PrimaryWeapon);
}
if (name.ToLower() == "all")
{
foreach (ServerClient client in GetClients())
{
Client.Ammo.PrimaryAmmo += Convert.ToInt32(ammo);
Client.Ammo.PrimaryAmmoClip += GetWeaponClipSize(Client.Other.PrimaryWeapon);
}
}
else
{
foreach (ServerClient client in GetClients())
{
if (client.Name.ToLower().Contains(name.ToLower()))
{
Client.Ammo.PrimaryAmmo += Convert.ToInt32(ammo);
Client.Ammo.PrimaryAmmoClip += GetWeaponClipSize(Client.Other.PrimaryWeapon);
}
}
}
}
return ChatType.ChatNone;
}
else
{
return ChatType.ChatContinue;
}
}
}
}




I searched the stock ammo's in the MW3 wiki and added them in a Dictionary manually before that
![[Image: compiling.png]](http://imgs.xkcd.com/comics/compiling.png)