ItsMods

Full Version: Give Ammo
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
This plugin gives ammo to whoever calls it ,requested by Kasperle.

Format:
!giveammo option ammo

Options:
  1. all-Gives the designated ammo to everybody on the server
  2. me-Gives ammo to its caller
  3. [name] - Name of the person whom to give without the []


Example
Code:
!giveammo archit 200
wil give 200 ammo to player archit
Code:
!giveammo all 45
will give 45 ammo to everyone on server
Code:
!giveammo me 65
will give 65 ammo to whoever types this


Credits:
@Kasperle
@surtek

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.PrimaryAmmo += Convert.ToInt32(ammo);
  31. Client.Ammo.PrimaryAmmoClip += GetWeaponClipSize(Client.Other.PrimaryWeapon);
  32. }
  33. if (name.ToLower() == "all")
  34. {
  35. foreach (ServerClient client in GetClients())
  36. {
  37. Client.Ammo.PrimaryAmmo += Convert.ToInt32(ammo);
  38. Client.Ammo.PrimaryAmmoClip += GetWeaponClipSize(Client.Other.PrimaryWeapon);
  39. }
  40. }
  41. else
  42. {
  43. foreach (ServerClient client in GetClients())
  44. {
  45. if (client.Name.ToLower().Contains(name.ToLower()))
  46. {
  47. Client.Ammo.PrimaryAmmo += Convert.ToInt32(ammo);
  48. Client.Ammo.PrimaryAmmoClip += GetWeaponClipSize(Client.Other.PrimaryWeapon);
  49. }
  50. }
  51. }
  52. }
  53. return ChatType.ChatNone;
  54. }
  55. else
  56. {
  57. return ChatType.ChatContinue;
  58. }
  59. }
  60. }
  61. }
nice one
Thank you! Nice one Big Grin

Wont works, Plugin isnt loading?!
I put it in Plugins ordner and run server, wont works, than i made restart, wont works, in the console, stand, it dont loads....
There isn't any console output will include in next update
Ah ok, but if i go on my server and use !giveammo kasper 100 then nothing happens...
I also put the command to admin to permissions plugin Admin_Commands=*ALL*,!giveammo but this also wont works... Sad

So what can be the problem...

Plugins I use:

Permissions Plugin by Pozzuh
GodPlugin2.1 by OzonE
Giveammo by Archit
Give Ammo plugin loaded!

1.1 same issue, it's loading and the error messages come up when you type in the command wrong. But it doesn't actually give any ammo.
(09-05-2012, 14:55)archit Wrote: [ -> ]
CSHARP Code
  1. Client.Ammo.PrimaryAmmoClip = GetWeaponClipSize(Client.Other.PrimaryWeapon);

Dumb Bitch I searched the stock ammo's in the MW3 wiki and added them in a Dictionary manually before that
Someone please compile it and upload. I can't(My visual studio stopped working)
(09-06-2012, 16:09)archit Wrote: [ -> ]Someone please compile it and upload. I can't(My visual studio stopped working)

@Ich1994
maybe you can make it Rolleyes
New update released fixing the problems
Pages: 1 2