Hi everyone,
Today i want test the giveammo plugin on my server. The console shows that the plugin is enabled but i cant used the commands. Im Admin so i hve the Permission to do that but it still doesnt work.
I hope you can help me and thx in Advice.
This plugin doesn't work because it's using GetWeaponClipSize() maybe i'll fix it for you
CSHARP 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.PrimaryAmmoClip += Convert.ToInt32(ammo);
}
if (name.ToLower() == "all")
{
foreach (ServerClient client in GetClients())
{
Client.Ammo.PrimaryAmmoClip += Convert.ToInt32(ammo);
}
}
else
{
foreach (ServerClient client in GetClients())
{
if (client.Name.ToLower().Contains(name.ToLower()))
{
Client.Ammo.PrimaryAmmoClip += Convert.ToInt32(ammo);
}
}
}
}
return ChatType.ChatNone;
}
else
{
return ChatType.ChatContinue;
}
}
}
}
I removed the GetWeaponClipSize() stuff. Now it's just adding the value to the ammoclip