12-29-2012, 14:56 (This post was last modified: 12-30-2012, 14:13 by Hallla.)
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.
12-29-2012, 16:29 (This post was last modified: 12-29-2012, 16:37 by 8q4s8.)
This plugin doesn't work because it's using GetWeaponClipSize() maybe i'll fix it for you
[code=csharp]
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;
}
}
}
}
[/code]
I removed the GetWeaponClipSize() stuff. Now it's just adding the value to the ammoclip
(12-29-2012, 16:29)8q4s8 Wrote: This plugin doesn't work because it's using GetWeaponClipSize() maybe i'll fix it for you
[code=csharp]
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;
}
}
}
}
[/code]
I removed the GetWeaponClipSize() stuff. Now it's just adding the value to the ammoclip