OldSchoolHack

Registrieren / Anmelden Deutsch

[MW3] Server Addons [Update 08.02.2012]

icon Thema: [MW3] Server Addons [Update 08.02.2012]

Anmeldungsdatum: Mär 2010

Beiträge: 220

Hi people, this is my first shit coded-compiled EVER. This is not much useful, but im happy releasing something
Also report bugs and   +rep   will help my reputation
EDIT: YOU NEED THE Pozzuh's ADMIN PLUGIN OR ALL PEOPLE WILL BE ABLE TO CHANGE IT
New version now out! Use !setupxp at the first time you use this version!
Usage:
TEXT Code:
  1.  
  2. !setupxp <= Use this at first time!!!
  3. !xp [Number Optional] <= XP Per Kill
  4. !hxp [Number Optional] <= XP Per HeadShot
  5. !sxp [Number Optional] <= XP Per Suicide
  6.  
Example:

!hxp <= This will show how many XP do you get per HeadShot.
             
!sxp 1000 <= You will get 1000 XP per suicide.

Source Code:
TEXT Code:
  1.  
  2. using Addon;
  3. using System;
  4. using System.IO;
  5. namespace xpmanager
  6. {
  7. public class xpmanagerclass : CPlugin
  8. {
  9. public override void OnServerLoad()
  10. {
  11. ServerPrint("XP Manager V1.75 Loaded Successfully. Author: slipknotignacio");
  12. }
  13. public override ChatType OnSay(string Message, ServerClient Client)
  14. {
  15. if (Message.StartsWith("!setupxp"))
  16. {
  17. if (GetDvar("scr_dm_score_kill") == "")
  18. {
  19. string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.cfg");
  20. string Path = Directory.GetCurrentDirectory() + "/admin/server.cfg";
  21. foreach (string file in files)
  22. if (file.ToLower().EndsWith("server.cfg"))
  23. Path = file;
  24. string text = File.ReadAllText(Path) +
  25. "\nseta scr_dm_score_kill \"100\"";
  26. File.WriteAllText(Path, text);
  27. TellClient(Client.ClientNum, "Kill XP fixed. You need to restart the map.", true);
  28. }
  29. else
  30. {
  31. TellClient(Client.ClientNum, "You dont need to setup Kill XP. Its OK.", true);
  32. }
  33. if (GetDvar("scr_dm_score_headshot") == "")
  34. {
  35. string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.cfg");
  36. string Path = Directory.GetCurrentDirectory() + "/admin/server.cfg";
  37. foreach (string file in files)
  38. if (file.ToLower().EndsWith("server.cfg"))
  39. Path = file;
  40. string text = File.ReadAllText(Path) +
  41. "\nseta scr_dm_score_headshot \"100\"";
  42. File.WriteAllText(Path, text);
  43. TellClient(Client.ClientNum, "HeadShot XP fixed. You need to restart the map.", true);
  44. }
  45. else
  46. {
  47. TellClient(Client.ClientNum, "You dont need to setup HeadShot XP. Its OK.", true);
  48. }
  49. if (GetDvar("scr_dm_score_suicide") == "")
  50. {
  51. string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.cfg");
  52. string Path = Directory.GetCurrentDirectory() + "/admin/server.cfg";
  53. foreach (string file in files)
  54. if (file.ToLower().EndsWith("server.cfg"))
  55. Path = file;
  56. string text = File.ReadAllText(Path) +
  57. "\nseta scr_dm_score_suicide \"0\"";
  58. File.WriteAllText(Path, text);
  59. TellClient(Client.ClientNum, "Suicide XP fixed. You need to restart the map.", true);
  60. }
  61. else
  62. {
  63. TellClient(Client.ClientNum, "You dont need to setup Suicide XP. Its OK.", true);
  64. }
  65. return ChatType.ChatNone;
  66. }
  67. string lowMsg = Message.ToLower();
  68. if (lowMsg.StartsWith("!xp"))
  69. {
  70. string[] splitMsg = lowMsg.Split(' ');
  71. String xp = GetDvar("scr_dm_score_kill");
  72. if (splitMsg.Length == 1)
  73. TellClient(Client.ClientNum, "^1Your Current Kill XP Is: " + xp, true);
  74. else
  75. {
  76. try
  77. {
  78. int NewXPValue = Convert.ToInt32(splitMsg[1]);
  79. string qxp = NewXPValue.ToString();
  80. SetDvar("scr_dm_score_kill", qxp);
  81. TellClient(Client.ClientNum, "^1Kill XP Changed To: " + NewXPValue, true);
  82. }
  83. catch (Exception e)
  84. {
  85. TellClient(Client.ClientNum, "^1Invalid Kill XP Value!", true);
  86. }
  87. }
  88. return ChatType.ChatNone;
  89. }
  90.  
  91. if (lowMsg.StartsWith("!hxp"))
  92. {
  93. string[] splitMsg = lowMsg.Split(' ');
  94. String hxp = GetDvar("scr_dm_score_headshot");
  95. if (splitMsg.Length == 1)
  96. TellClient(Client.ClientNum, "^1Your Current HeadShot XP Is: " + hxp, true);
  97. else
  98. {
  99. try
  100. {
  101. int NewHXPValue = Convert.ToInt32(splitMsg[1]);
  102. string qhxp = NewHXPValue.ToString();
  103. SetDvar("scr_dm_score_headshot", qhxp);
  104. TellClient(Client.ClientNum, "^1HeadShot XP Changed To: " + NewHXPValue, true);
  105. }
  106. catch (Exception e)
  107. {
  108. TellClient(Client.ClientNum, "^1Invalid HeadShot XP Value!", true);
  109. }
  110. }
  111. return ChatType.ChatNone;
  112. }
  113.  
  114. if (lowMsg.StartsWith("!sxp"))
  115. {
  116. string[] splitMsg = lowMsg.Split(' ');
  117. String sxp = GetDvar("scr_dm_score_suicide");
  118. if (splitMsg.Length == 1)
  119. TellClient(Client.ClientNum, "^1Your Current Suicide XP Is: " + sxp, true);
  120. else
  121. {
  122. try
  123. {
  124. int NewSuicideXPValue = Convert.ToInt32(splitMsg[1]);
  125. string qsxp = NewSuicideXPValue.ToString();
  126. SetDvar("scr_dm_score_suicide", qsxp);
  127. TellClient(Client.ClientNum, "^1Suicide XP Changed To: " + NewSuicideXPValue, true);
  128. }
  129. catch (Exception e)
  130. {
  131. TellClient(Client.ClientNum, "^1Invalid Suicide XP Value!", true);
  132. }
  133. }
  134. return ChatType.ChatNone;
  135. }
  136. return ChatType.ChatContinue;
  137. }
  138. }
  139. }
  140.  

Changelog V1.75
TEXT Code:
  1.  
  2. Fixed major bug when the commands doesnt work if you dont have already set the values in your server.cfg
  3. Code optimized
  4.  

Changelog V1.00
TEXT Code:
  1.  
  2. Initial Release
  3.  

Credits:
Me => Obvious
Users of ItsMods => To Releasing their source code and I studied it
Pozzuh and iAegle => For the big help

Virus Scan: Um Links zu sehen, musst du dich registrieren

MD5: 9AB2204C6BBDAED70E87275A7F265764



__________________

http://no-haking.square7.ch/images/wbb3-header-logo.png