Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdkhooks>
- #pragma semicolon 1
- #pragma newdecls required
- #pragma tabsize 0
- #define KvPath "configs/chatbans.cfg"
- char g_BannedWords[256][PLATFORM_MAX_PATH];
- char configFile[PLATFORM_MAX_PATH];
- int wordstotal;
- public void OnPluginStart()
- {
- BuildPath(Path_SM, configFile, sizeof(configFile), KvPath);
- AddCommandListener(Command_Say, "say");
- AddCommandListener(Command_Say, "say_team");
- AutoExecConfig(true, "chatbans_cvars", "sourcemod");
- }
- public void OnMapStart()
- {
- LoadWords();
- }
- public Action Command_Say(int client, const char[] command, int argc)
- {
- char sText[192];
- GetCmdArgString(sText, sizeof(sText));
- StripQuotes(sText);
- for(int i=0; i < wordstotal; i++)
- {
- if(!StrEqual("", g_BannedWords[i], false) && (StrContains(sText, g_BannedWords[i], false) != -1 || StrEqual(sText, g_BannedWords[i], false))){
- KickClient(client, "bye bye everybody");
- return Plugin_Handled;
- }
- }
- return Plugin_Continue;
- }
- public void LoadWords()
- {
- wordstotal = 0;
- KeyValues kv = new KeyValues("Words");
- if (!FileExists(configFile)) {
- LogError("The playerbans config file (%s) does not exist", configFile);
- }
- if (!kv.ImportFromFile(configFile) || !kv.GotoFirstSubKey()) {
- LogError("The executes spawns file was empty");
- delete kv;
- return;
- }
- do{
- kv.GetSectionName(g_BannedWords[wordstotal], sizeof(g_BannedWords[]));
- wordstotal++;
- }while(kv.GotoNextKey());
- kv.Rewind();
- delete kv;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement