ItsMods

Full Version: Help !giveammo Plugin doesnt work [solved]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
I can help you but, can you maybe post a link.
I think you mean this topic.
http://www.itsmods.com/forum/Thread-Rele...-Ammo.html ?
This plugin doesn't work because it's using GetWeaponClipSize() maybe i'll fix it for you

CSHARP Code
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Addon;
  5.  
  6. namespace giveammo
  7. {
  8. public class Class1 : CPlugin
  9. {
  10. public override void OnServerLoad()
  11. {
  12. ServerPrint("Give Ammo plugin loaded!");
  13. }
  14. public override ChatType OnSay(string Message, ServerClient Client, bool Teamchat)
  15. {
  16. if (Message.ToLower().StartsWith("!giveammo"))
  17. {
  18. string[] options = Message.Split(' ');
  19. if (options.Length != 3)
  20. {
  21. TellClient(Client.ClientNum, "^2GiveAmmo: ^4Wrong options try again", true);
  22. TellClient(Client.ClientNum, "^2GiveAmmo: ^4Format:!giveammo [playername] [ammo]", true);
  23. }
  24. else
  25. {
  26. string name = options[1];
  27. string ammo = options[2];
  28. if (name.ToLower() == "me")
  29. {
  30. Client.Ammo.PrimaryAmmoClip += Convert.ToInt32(ammo);
  31. }
  32. if (name.ToLower() == "all")
  33. {
  34. foreach (ServerClient client in GetClients())
  35. {
  36. Client.Ammo.PrimaryAmmoClip += Convert.ToInt32(ammo);
  37. }
  38. }
  39. else
  40. {
  41. foreach (ServerClient client in GetClients())
  42. {
  43. if (client.Name.ToLower().Contains(name.ToLower()))
  44. {
  45. Client.Ammo.PrimaryAmmoClip += Convert.ToInt32(ammo);
  46. }
  47. }
  48. }
  49. }
  50. return ChatType.ChatNone;
  51. }
  52. else
  53. {
  54. return ChatType.ChatContinue;
  55. }
  56. }
  57. }
  58. }


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

CSHARP Code
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Addon;
  5.  
  6. namespace giveammo
  7. {
  8. public class Class1 : CPlugin
  9. {
  10. public override void OnServerLoad()
  11. {
  12. ServerPrint("Give Ammo plugin loaded!");
  13. }
  14. public override ChatType OnSay(string Message, ServerClient Client, bool Teamchat)
  15. {
  16. if (Message.ToLower().StartsWith("!giveammo"))
  17. {
  18. string[] options = Message.Split(' ');
  19. if (options.Length != 3)
  20. {
  21. TellClient(Client.ClientNum, "^2GiveAmmo: ^4Wrong options try again", true);
  22. TellClient(Client.ClientNum, "^2GiveAmmo: ^4Format:!giveammo [playername] [ammo]", true);
  23. }
  24. else
  25. {
  26. string name = options[1];
  27. string ammo = options[2];
  28. if (name.ToLower() == "me")
  29. {
  30. Client.Ammo.PrimaryAmmoClip += Convert.ToInt32(ammo);
  31. }
  32. if (name.ToLower() == "all")
  33. {
  34. foreach (ServerClient client in GetClients())
  35. {
  36. Client.Ammo.PrimaryAmmoClip += Convert.ToInt32(ammo);
  37. }
  38. }
  39. else
  40. {
  41. foreach (ServerClient client in GetClients())
  42. {
  43. if (client.Name.ToLower().Contains(name.ToLower()))
  44. {
  45. Client.Ammo.PrimaryAmmoClip += Convert.ToInt32(ammo);
  46. }
  47. }
  48. }
  49. }
  50. return ChatType.ChatNone;
  51. }
  52. else
  53. {
  54. return ChatType.ChatContinue;
  55. }
  56. }
  57. }
  58. }


I removed the GetWeaponClipSize() stuff. Now it's just adding the value to the ammoclip

Thank you so much Big Grin.