NOTICE
This plugin does not work with the newest versoin of the server addon
Please wait while I convert them
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
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
- //JariZ's Rules plugin
-
- #include "stdafx.h"
- #include "windows.h"
- #include <ctime>
- #include <sstream>
- #include <fstream>
- #include <iostream>
- #include <vector>
- using namespace std;
- using namespace Server::CPlugin;
-
- void con(string ss)
- {
- ConsolePrint((PCHAR)ss.c_str());
- }
-
- vector<string> memrules;
- vector<string> getRules()
- {
- vector<string> output;
- ifstream rules("addon\\rules.txt");
- if(rules.is_open())
- {
- while(rules.good())
- {
- string rule = "";
- getline(rules, rule);
-
- output.push_back(rule);
- }
- rules.close();
- }
- else { output.push_back("Rules are not loaded (couldn't open file)"); }
- return output;
- }
- PLUGIN_API_ONSERVERLOAD
- {
- ConsolePrint("Plugin: " PLUG_NAME " loaded. Author: " PLUG_AUTHOR);
- ConsolePrint("Loading rules.txt into memory...");
- memrules = getRules();
- con("---- Current rules ----");
- for each(string s in memrules)
- {
- con(s);
- }
- con("-----------------------");
- }
-
- 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;
- }
Download
RulesPlugin4.zip (Size: 15.08 KB / Downloads: 59)