Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // includes
- #include <windows.h>
- #include <stdio.h>
- #include <string>
- #include "./headers/FLHook.h"
- #include "./headers/plugin.h"
- PLUGIN_RETURNCODE returncode;
- EXPORT void UserCmd_Help(uint iClientID, wstring wscParam)
- {
- PrintUserCmdText(iClientID, L"/rules [pagenum]");
- }
- EXPORT PLUGIN_RETURNCODE Get_PluginReturnCode()
- {
- return returncode;
- }
- EXPORT void UserCmd_Rules(uint iClientID, wstring wscParam)
- {
- PrintUserCmdText(iClientID, L"test");
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
- typedef void (*_UserCmdProc)(uint, wstring);
- struct USERCMD
- {
- wchar_t *wszCmd;
- _UserCmdProc proc;
- };
- USERCMD UserCmds[] =
- {
- { L"/rules", UserCmd_Rules},
- };
- EXPORT bool UserCmd_Process(uint iClientID, wstring wscCmd)
- {
- wstring wscCmdLower = ToLower(wscCmd);
- for(uint i = 0; (i < sizeof(UserCmds)/sizeof(USERCMD)); i++)
- {
- if(wscCmdLower.find(ToLower(UserCmds[i].wszCmd)) == 0)
- {
- wstring wscParam = L"";
- if(wscCmd.length() > wcslen(UserCmds[i].wszCmd))
- {
- if(wscCmd[wcslen(UserCmds[i].wszCmd)] != ' ')
- continue;
- wscParam = wscCmd.substr(wcslen(UserCmds[i].wszCmd) + 1);
- }
- UserCmds[i].proc(iClientID, wscParam);
- returncode = SKIPPLUGINS_NOFUNCTIONCALL; // we handled the command, return immediatly
- return true;
- }
- }
- returncode = DEFAULT_RETURNCODE; // we did not handle the command, so let other plugins or FLHook kick in
- return false;
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
- BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
- {
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement