ItsMods

Full Version: Rules plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
NOTICE
This plugin does not work with the newest versoin of the server addon
Please wait while I convert them

What is it?
A small plugin that shows the rules when a user types !rules
Haven't gotten the chance to test it (net really sucks) but in theory it should work

[Image: 834vg.png]

How do I install it?
Extract all the folders in the zip to your server
Then go to /addon/ and open the file rules.txt
Here you can change all rules

Changelog
1.0
- Initial release
1.0.0.0.0.0.1
- Fixed command bug
- Made it so that the chat doesn't go to the game

Source
C++ Code
  1. //JariZ's Rules plugin
  2.  
  3. #include "stdafx.h"
  4. #include "windows.h"
  5. #include <ctime>
  6. #include <sstream>
  7. #include <fstream>
  8. #include <iostream>
  9. #include <vector>
  10. using namespace std;
  11. using namespace Server::CPlugin;
  12.  
  13. void con(string ss)
  14. {
  15. ConsolePrint((PCHAR)ss.c_str());
  16. }
  17.  
  18. vector<string> memrules;
  19. vector<string> getRules()
  20. {
  21. vector<string> output;
  22. ifstream rules("addon\\rules.txt");
  23. if(rules.is_open())
  24. {
  25. while(rules.good())
  26. {
  27. string rule = "";
  28. getline(rules, rule);
  29.  
  30. output.push_back(rule);
  31. }
  32. rules.close();
  33. }
  34. else { output.push_back("Rules are not loaded (couldn't open file)"); }
  35. return output;
  36. }
  37. PLUGIN_API_ONSERVERLOAD
  38. {
  39. ConsolePrint("Plugin: " PLUG_NAME " loaded. Author: " PLUG_AUTHOR);
  40. ConsolePrint("Loading rules.txt into memory...");
  41. memrules = getRules();
  42. con("---- Current rules ----");
  43. for each(string s in memrules)
  44. {
  45. con(s);
  46. }
  47. con("-----------------------");
  48. }
  49.  
  50. PLUGIN_API_ONSAY
  51. {
  52. //con(Message);
  53. string s = Message;
  54. //con(s.substr(0, 6));
  55. if(s.substr(0, 6) == "!rules")
  56. {
  57. //con("rules = okay");
  58. for each(string s in memrules)
  59. {
  60. //con(s);
  61. ServerSay((PCHAR)s.c_str(), true);
  62. }
  63. return CHAT_NONE;
  64. }
  65. return CHAT_ALL;
  66. }


Download
[attachment=1355]
lulz it's broken, will fix it in a few hours
fix'd
euhm now this will block the whole chat ...

Code:
PLUGIN_API_ONSAY
{
    //con(Message);
    string s = Message;
    //con(s.substr(0, 6));
    if(s.substr(0, 6) == "!rules")
    {
        con("rules = okay");
        for each(string s in memrules)
        {
            //con(s);
            ServerSay((PCHAR)s.c_str(), true);
        }
        return CHAT_NONE;
    }
    return CHAT_ALL;
}

edit: nvm you just fixed it D:
yep, like I said, hadn't tested it.
Not working for me
Not working (
Still does not work, after your update.
Are you sure? It works fine for me...
Explain what's not working please
I really suck at releasing stuff I guess, stupid winrar...
:FUU: :FUU: :FUU: :FUU:
Reuploaded, blame itsmods attachment system and/or winrar
Imma test later not at computer ill respond if it works if there are still problems with it not working
FUCK IT BLOCKS THE WHOLE CHAT GODDAMNED Fuu
Fixing it (again)
hold on...
ok fixed, (I HOPE)
didn't thought i'd have this much work on a stupid plugin like this
Pages: 1 2 3