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

[align=center]UPDATED[/align]
MW3 Addon Plugin Pack 1

This was a pack based on @jariz code, I recreated(recoded) this pack for the newest version of MW3 server addon :awesome:


How to install?
Copy the DLL to MW3 Server\plugins

Sourcecode
  1. This code is supposed to be used to help you start creating your own plugin, so re-rereleasing any of this code without a significant change is strictly forbidden
  2. When used, my credits must be included
  3. Have fun coding!


Requirements


This pack includes
  • FOV
    Changes FOV and FOVscale for every client in the server,
    fov defaults to 80, fovscale to 1.0
    Add this to addon\sv_config.ini in order to use a custom value for the fov amount:
    TEXT Code:
    1.  
    2. [FOV]
    3. fov=80
    4. fovscale=1.125
    5.  
    Where '80' is your amount of FOV and '1.125' your FOVscale offcourse
  • Welcomer
    Says 'Everybody welcome PLAYERNAME to the server!'
    Don't know how it's useful, just makes your server looks awesome i think
  • PlayerLog
    Logs all players who connect to the server in addon\logs\player.log
    It logs: Client ID, Name, XUID and Ping (at time of connection)
    Useful if you want to report someone or just find out who connected to your server.


Credits
-@Tylerd86(Coding)
- @jariz (Orginal codes and coding)
- @Nukem (Addon)

Plugin source code
Spoiler

Welcomer
TEXT Code:
  1. using System;
  2. using Addon;
  3.  
  4. namespace plugin_test
  5. {
  6. public class plugin_test : CPlugin
  7. {
  8. public override void OnServerLoad()
  9. {
  10. ServerPrint("Welcomer plugin by Tylerd86 loaded!");
  11. }
  12.  
  13. public override void OnPlayerConnect(ServerClient Client)
  14. {
  15. ServerSay("^7Welcomer: ^2Everyone welcome ^3" + Client.Name + " ^2to the server!", true);
  16. }
  17. }
  18. }
Fov
TEXT Code:
  1. using System;
  2. using Addon;
  3.  
  4. namespace fov
  5. {
  6. public class fov : CPlugin
  7. {
  8. public override void OnServerLoad()
  9. {
  10. ServerPrint("Fov plugin loaded! by Tylerd86 & JariZ");
  11. }
  12.  
  13. public override void OnPlayerConnect(ServerClient Client)
  14. {
  15. SetClientDvar(Client.ClientNum, string.Format("cg_fov \"{0}\"", GetServerCFG("FOV", "fov", "80")));
  16. SetClientDvar(Client.ClientNum, string.Format("cg_fovscale \"{0}\"", GetServerCFG("FOV", "fovscale", "1.125")));
  17. }
  18. }
  19. }
PlayerLog
TEXT Code:
  1. using System;
  2. using Addon;
  3. using System.IO;
  4.  
  5. namespace PlayerLog
  6. {
  7. public class PlayerLog : CPlugin
  8. {
  9. string logpath = "addon\\logs\\player.log";
  10. public override void OnServerLoad()
  11. {
  12. ServerPrint("PlayerLog loaded! by Tylerd86 & JariZ :D");
  13. }
  14.  
  15. void writeCollumns()
  16. {
  17. StreamWriter rw = new StreamWriter(logpath, false);
  18. rw.WriteLine("NUM NAME XUID RATE PING");
  19. rw.Close();
  20. }
  21.  
  22. public override void OnPlayerConnect(ServerClient Client)
  23. {
  24. try
  25. {
  26. if (File.Exists(logpath))
  27. {
  28. writeCollumns();
  29. if (File.ReadAllText(logpath) == string.Empty)
  30. writeCollumns();
  31. }
  32. StreamWriter sr = new StreamWriter(logpath, true);
  33. sr.WriteLine(Client.ClientNum + " " + Client.Name + " " + Client.XUID + " " + Client.Rate + " " + Client.Ping);
  34. sr.Close();
  35. }
  36. catch (Exception z) { ServerPrint("[PLAYERLOG] " + z.ToString()); }
  37. }
  38. }
  39. }



__________________

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