Raised This Month: $51 Target: $400
 12% 

Solved [CS:GO] Banned words


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Javierko
AlliedModders Donor
Join Date: Sep 2017
Location: Czech republic
Old 11-16-2017 , 10:10   [CS:GO] Banned words
Reply With Quote #1

Hey guys,

if there somebody who will make some basic plugin like this:

When somebody type words (i will add manually) "javierko", it will say for him to chat "You cant use this words". And the message "javierko" will be deleted or not posted.

Thanks, if you help me.

Last edited by Javierko; 11-17-2017 at 07:12. Reason: solved...
Javierko is offline
Bobakanoosh
Senior Member
Join Date: Sep 2015
Location: United States
Old 11-16-2017 , 11:08   Re: [CS:GO] Banned words
Reply With Quote #2

Tested, works.

PHP Code:
char g_sBlockedWords[][] = {"poop""shit""crap"};

public 
Action OnClientSayCommand(int client, const char[] command, const char[] sArgs) {

    if(
client || client MaxClients)
        return 
Plugin_Continue;
        
    if (!
IsClientInGame(client))
        return 
Plugin_Continue;
        
    for(
int i 0sizeof(g_sBlockedWords[]); i++) {
    
        if(
StrContains(sArgsg_sBlockedWords[i]) != -1) {
        
            
PrintToChat(client"The word %s is blocked!"g_sBlockedWords[i]);
            return 
Plugin_Stop;
        
        }
    
    }

    return 
Plugin_Continue;



Last edited by Bobakanoosh; 11-16-2017 at 14:50. Reason: CPrintToChat --> PrintToChat
Bobakanoosh is offline
Javierko
AlliedModders Donor
Join Date: Sep 2017
Location: Czech republic
Old 11-16-2017 , 14:28   Re: [CS:GO] Banned words
Reply With Quote #3

At compile i have this error

//SourceMod Batch Compiler
// by the SourceMod Dev Team


//// zakazaneslova.sp
//
// C:\Users\User\Desktop\scripting\zakazaneslova .sp(30) : error 017: undefined symbol "CPrintToChat"
//
// 1 Error.
//
// Compilation Time: 0,41 sec
// ----------------------------------------

Press enter to exit ...
Javierko is offline
Bobakanoosh
Senior Member
Join Date: Sep 2015
Location: United States
Old 11-16-2017 , 14:50   Re: [CS:GO] Banned words
Reply With Quote #4

Sorry, used to using CPrint, use PrintToChat instead.
Bobakanoosh is offline
Javierko
AlliedModders Donor
Join Date: Sep 2017
Location: Czech republic
Old 11-16-2017 , 15:12   Re: [CS:GO] Banned words
Reply With Quote #5

//SourceMod Batch Compiler
// by the SourceMod Dev Team


//// zakazaneslova.sp
//
// C:\Users\User\Desktop\scripting\zakazaneslova .sp(25) : error 163: indeterminate array size in "sizeof" expression (symbol "g_sBlockedWords")
//
// 1 Error.
//
// Compilation Time: 0,41 sec
// ----------------------------------------

Press enter to exit ...
Javierko is offline
Bobakanoosh
Senior Member
Join Date: Sep 2015
Location: United States
Old 11-16-2017 , 16:03   Re: [CS:GO] Banned words
Reply With Quote #6

Odd, I have no issues.

Welp, can do it manually I suppose. Count how many words there are in your list, and where it says X in the code below, place that number. For my example above, X = 3.

PHP Code:
for(int i 0Xi++) 
So overall it should look like
PHP Code:
    for(int i 03i++) {
    
        if(
StrContains(sArgsg_sBlockedWords[i]) != -1) {
        
            
PrintToChat(client"The word %s is blocked!"g_sBlockedWords[i]);
            return 
Plugin_Stop;
        
        }
    
    } 
Bobakanoosh is offline
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 11-16-2017 , 16:13   Re: [CS:GO] Banned words
Reply With Quote #7

Quote:
Originally Posted by Javierko View Post
//SourceMod Batch Compiler
// by the SourceMod Dev Team


//// zakazaneslova.sp
//
// C:\Users\User\Desktop\scripting\zakazaneslova .sp(25) : error 163: indeterminate array size in "sizeof" expression (symbol "g_sBlockedWords")
//
// 1 Error.
//
// Compilation Time: 0,41 sec
// ----------------------------------------

Press enter to exit ...
You added too many words. Try this:

PHP Code:
#include <sourcemod>
#include <csgocolors>

#define tag "BAD WORD"

char g_sBlockedWords[][200] = {"word""word1""word2""word3""word4""word5""word6""word7""word8""word9""word10""word11""word11""word12""gg ez"};

public 
Action OnClientSayCommand(int client, const char[] command, const char[] sArgs) {

    if(
client || client MaxClients)
        return 
Plugin_Continue;
        
    if (!
IsClientInGame(client))
        return 
Plugin_Continue;
        
    for(
int i 0sizeof(g_sBlockedWords[]); i++) {
    
        if(
StrContains(sArgsg_sBlockedWords[i]) != -1) {
        
            
CPrintToChat(client"{default}[{orange} %s {default}]The word {green}%s {default}is {red}blocked{default}!"tagg_sBlockedWords[i]);
            return 
Plugin_Stop;
        }
    }

    return 
Plugin_Continue;


Attached Files
File Type: inc csgocolors.inc (14.9 KB, 129 views)
__________________

Last edited by PinHeaDi; 11-16-2017 at 16:39. Reason: Include added.
PinHeaDi is offline
Javierko
AlliedModders Donor
Join Date: Sep 2017
Location: Czech republic
Old 11-17-2017 , 07:11   Re: [CS:GO] Banned words
Reply With Quote #8

Thanks, it works perfectly.

Solved....
Javierko is offline
ASKER_CZ
BANNED
Join Date: Nov 2016
Old 11-17-2017 , 12:09   Re: [CS:GO] Banned words
Reply With Quote #9

Can someone make this with regex support?
ASKER_CZ is offline
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 11-17-2017 , 13:31   Re: [CS:GO] Banned words
Reply With Quote #10

Why reinvent the wheel?

https://forums.alliedmods.net/showthread.php?p=2458429
__________________
sneaK is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:22.


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