AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [CS:GO] !knife !ws !gloves Prevention (https://forums.alliedmods.net/showthread.php?t=300660)

Aaronpierce 08-24-2017 18:50

[CS:GO] !knife !ws !gloves Prevention
 
1 Attachment(s)
Description

Hey there. I run about 3 servers and constantly have people coming in and typing !knife. It annoys me because it's not in the title of my server they just assume it's there and don't realize Valve's set rules. In response to all this, I made a simple chat message plugin when people type !knife it says the phrase:

We do not have this plugin because it's against Valve's TOS. We are children of Jesus.


This plugin is specifically for CS:GO

P.S. I'm fairly new to making plugins so go easy on me. I usually only mess around with HTML.

Commands
  • sm_knife
Installation
  1. Drag knife.sp into your scripting folder
  2. Drag knife.smx into your plugins folder

Code

PHP Code:

#pragma semicolon 1 
#pragma newdecls required 

#include <sourcemod> 

 
public Plugin myinfo =
{
    
name "Prevent !knife !ws !gloves",
    
author "Fig Newtons (Aaronpierce)",
    
description "Any player that executes commands: !knife !ws etc are greeted with a message saying those plugins aren't allowed.",
    
version "1.1",
    
url ""
};

public 
void OnPluginStart() 

    
RegConsoleCmd("sm_knife"Command_Print);
    
RegConsoleCmd("sm_ws"Command_Print);  
    
RegConsoleCmd("sm_gloves"Command_Print);  


public 
Action Command_Print(int clientint args
{
    if (
IsClientInGame(client))
    {
        
PrintToChat(client"We do not have this plugin because it's against Valve's TOS. We are children of Jesus."); 
    }
    return 
Plugin_Handled


Changelog
1.1 - Added !ws and !gloves to message output.

Extra Notes
I will probably be adding a sound to this and add !gloves and !ws to it as well. Currently, !ws and !gloves plugins I've just recently made after this one, will eventually be merged into this one.
If there are any bugs I will do my best to figure out how to fix them but keep in mind I am new.

Thanks for reading and hopefully this ends some of your frustrations too!

shanapu 08-24-2017 19:52

Re: !knife Troll
 
great idea, simple & clean code!
:bacon!::bacon!:

Russian85 08-24-2017 21:27

Re: !knife Troll
 
1 Attachment(s)
I think this is better:

Hide !knife, !ws and etc messages and print info.

Source:
PHP Code:

public Plugin myinfo =
{
    
name        =     "Hide Messages",
    
author      =     "Someone (AM Russian85)",
    
version     =     "1.0",
    
url         =     "http://hlmod.ru"
};

ArrayList g_hArray;

public 
void OnPluginStart()
{
    
g_hArray = new ArrayList(ByteCountToCells(32));
    
    
RegAdminCmd("sm_hm_reload"CMD_RELOADADMFLAG_ROOT);
    
    
LoadConfig();
}

public 
Action CMD_RELOAD(int iClientint iArgs)
{
    
LoadConfig();
    return 
Plugin_Handled;
}

void LoadConfig()
{
    
g_hArray.Clear();
    
KeyValues Kv = new KeyValues("Messages");
    
    
char sBuffer[PLATFORM_MAX_PATH];
    
BuildPath(Path_SMsBuffersizeof(sBuffer), "configs/hide_messages.ini");
    if (!
FileToKeyValues(KvsBuffer)) SetFailState("Unable to find config file %s"sBuffer);
    
    if (
Kv.GotoFirstSubKey())
    {
        do
        {
            if (
Kv.GetSectionName(sBuffersizeof(sBuffer)))
            {
                
g_hArray.PushString(sBuffer);
            }
        } 
        while (
Kv.GotoNextKey());
    }
    
delete Kv;
}

public 
Action OnClientSayCommand(int iClient, const char[] sCommand, const char[] sArgs)
{
    if(
IsClientInGame(iClient) && !IsFakeClient(iClient) && g_hArray.FindString(sArgs) != -1)
    {
        
PrintToChat(iClient"We do not have this plugin because it's against Valve's TOS. We are children of Jesus.");
        return 
Plugin_Handled;
    }
    return 
Plugin_Continue;


Config:
PHP Code:

"Messages"
{
    
"!knife"{}
    
"!ws"{}



vortex. 08-25-2017 08:35

Re: !knife Troll
 
:lol: Wonderful.

Aaronpierce 08-26-2017 14:38

Re: !knife Troll
 
Quote:

Originally Posted by Russian85 (Post 2544193)
I think this is better:

Hide !knife, !ws and etc messages and print info.

Source:
PHP Code:

public Plugin myinfo =
{
    
name        =     "Hide Messages",
    
author      =     "Someone (AM Russian85)",
    
version     =     "1.0",
    
url         =     "http://hlmod.ru"
};

ArrayList g_hArray;

public 
void OnPluginStart()
{
    
g_hArray = new ArrayList(ByteCountToCells(32));
    
    
RegAdminCmd("sm_hm_reload"CMD_RELOADADMFLAG_ROOT);
    
    
LoadConfig();
}

public 
Action CMD_RELOAD(int iClientint iArgs)
{
    
LoadConfig();
    return 
Plugin_Handled;
}

void LoadConfig()
{
    
g_hArray.Clear();
    
KeyValues Kv = new KeyValues("Messages");
    
    
char sBuffer[PLATFORM_MAX_PATH];
    
BuildPath(Path_SMsBuffersizeof(sBuffer), "configs/hide_messages.ini");
    if (!
FileToKeyValues(KvsBuffer)) SetFailState("Unable to find config file %s"sBuffer);
    
    if (
Kv.GotoFirstSubKey())
    {
        do
        {
            if (
Kv.GetSectionName(sBuffersizeof(sBuffer)))
            {
                
g_hArray.PushString(sBuffer);
            }
        } 
        while (
Kv.GotoNextKey());
    }
    
delete Kv;
}

public 
Action OnClientSayCommand(int iClient, const char[] sCommand, const char[] sArgs)
{
    if(
IsClientInGame(iClient) && !IsFakeClient(iClient) && g_hArray.FindString(sArgs) != -1)
    {
        
PrintToChat(iClient"We do not have this plugin because it's against Valve's TOS. We are children of Jesus.");
        return 
Plugin_Handled;
    }
    return 
Plugin_Continue;


Config:
PHP Code:

"Messages"
{
    
"!knife"{}
    
"!ws"{}



So what does this specifically do? It just hides the !knife and !ws messages in chat?

Russian85 08-28-2017 12:51

Re: !knife Troll
 
Quote:

Originally Posted by Aaronpierce (Post 2544506)
So what does this specifically do? It just hides the !knife and !ws messages in chat?

Hides what you want.

QuatZp 08-29-2017 01:31

Re: !knife Troll
 
Quote:

Originally Posted by Aaronpierce (Post 2544178)
PHP Code:

public void OnPluginStart() 

    
RegConsoleCmd("sm_knife"Command_Print); 


I will probably be adding [...] !gloves and !ws to it as well. Currently, !ws and !gloves plugins I've just recently made after this one, will eventually be merged into this one.


Just add (if sm_ws and sm_glove are correct)
PHP Code:

RegConsoleCmd("sm_ws"Command_Print);  
RegConsoleCmd("sm_glove"Command_Print); 

P.S. I have the same problem with these 'players'.

Aaronpierce 12-07-2018 14:36

Re: [CS:GO] !knife !ws !gloves Prevention
 
Update:

Decided to add some new additions to this plugin. I basically made it to when !knife !ws or !gloves is typed it displays the message. So in other words, I added two other commands !ws and !gloves.

Extra Notes:

Haven't decided whether I'm going to hide the commands in chat because I like seeing them type it knowing that they're seeing the message.

That's it! Thanks for checking in,

~ Aaron

_GamerX 12-07-2018 14:47

Re: [CS:GO] !knife !ws !gloves Prevention
 
best plugin of the year

Aaronpierce 12-07-2018 14:49

Re: [CS:GO] !knife !ws !gloves Prevention
 
Quote:

Originally Posted by _GamerX (Post 2627374)
best plugin of the year

Let me know what I should wear to accept the award. Beginning to rehearse my speech.


All times are GMT -4. The time now is 07:57.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.