Raised This Month: $32 Target: $400
 8% 

nametag player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
combocarte112
Senior Member
Join Date: Jun 2016
Location: Romania
Old 04-13-2020 , 03:26   nametag player
Reply With Quote #1

Hello, this plugin have a function that does not allow you to put a nametag from RestrictedTags.txt file, but this function does not work, players can set their nametag even if it is written in RestrictedTags.txt, does anyone help me solve the problem?



PHP Code:
#include <sourcemod>
#include <cstrike>
#include <clientprefs>
#include <chat-processor>

HandleOnlyAdmins
Handle
CheckTags
Handle
PrintTagAssign
Handle
OnlyNamed
Handle
NameStr

new HandleClientTag INVALID_HANDLE
new HandleClientTagColor INVALID_HANDLE
new HandleRestrictedTags INVALID_HANDLE

new StringRestrictedTagsFilePLATFORM_MAX_PATH ]

#define flag ADMFLAG_CUSTOM1

public Plugin:myinfo = {
    
name "Rich Client Tags",
    
author "tre3fla",
    
description "Jucatorii isi pot pune tag-uri in chat si scoreboard",
    
version "0.2",
    
url "http://extreamcs.com/forum"
}

public 
OnPluginStart( ) { 
    
OnlyAdmins CreateConVar"sm_tag_access_only_admins""1""0=toti jucatorii au acces la tag-uri, 1=doar admini cu un anumit flag" )
    
CheckTags CreateConVar"sm_tag_check""1""0=jucatorii isi pun ce tag vor, 1=nu isi pot pune tag-urile banate" )
    
PrintTagAssign =  CreateConVar"sm_print_on_tag_asssign""1""0=dezactivat, 1=jucatorului o sa-i apara un mesaj cand i se seteaza tag-ul, inclusiv la connectare" )
    
OnlyNamed CreateConVar"sm_tag_only_advertisers""1""0=dezactiva, 1=jucatorii trebuie sa poarte ceva la nume pentru a-l folosi" )
    
NameStr CreateConVar"sm_needed_name""alliedmods""Cuvantul care trebuie sa fie in componenta numelui pentru a folosi comanda !tag" )


    
ClientTag RegClientCookie"ClientTag""Tag-ul ales de jucator"CookieAccess_Protected )
    
ClientTagColor RegClientCookie"ClientTagColor""Culoarea pentru tag"CookieAccess_Protected )
    
    
RegConsoleCmd"tag"Command_AssignTag )
    
RegConsoleCmd"tc"Command_AssignTagColor )
    
RegConsoleCmd"tagcolor"Command_AssignTagColor )
    
RegConsoleCmd"tagcolorsinfo"Command_ShowColorInfo )
    
RegConsoleCmd"tagdisable"Command_DisableTag )
    
    
HookEvent"player_spawn"Event_PlayerSpawn )
    
    
HookEventEx"player_connect_full"player_connect_full )
}

public 
OnMapStart( ) {
    
ReadForbiddenTags( )
}

public 
player_connect_fullEvent:event, const String:name[ ], bool:dontBroadcast ) { 
    new 
client GetClientOfUserIdGetEventIntevent"userid" ) )
    
    if( 
IsClientConnectedclient ) && !IsFakeClientclient ) ) {
        
CreateTimer0.5TagTheClientclient )
    }
}

public 
ActionEvent_PlayerSpawnEvent event, const char[ ] namebool dontBroadcast ) {
    
int ClientUserId GetEventIntevent"userid" 
    
int client GetClientOfUserIdClientUserId )
    
    
decl StringTag16 ]
    
GetClientCookieclientClientTagTagsizeofTag ) )
    
    if( 
strlenTag ) > ) {
        
CS_SetClientClanTagclientTag )
    }
}

public 
ActionCommand_AssignTagclientargs ) {
    if( 
GetConVarIntOnlyAdmins ) > ) {
        if( !
CheckCommandAccessclient"sm_someoverride"flag ) ) {
            
PrintToChatclient"*\x02 You have no access to this command!" )
            return 
Plugin_Handled
        
}
    }

    if( 
GetConVarIntOnlyNamed ) > ) {
        
decl StringSuperName32 ]
        
GetClientNameclientSuperNamesizeofSuperName ) )

        
decl StringSuperWord32 ]
        
GetConVarStringNameStrSuperWordsizeofSuperWord ) )

        if( 
StrContainsSuperNameSuperWord ) == -|| StrContainsSuperNameSuperWordtrue ) == -) {
            
PrintToChatclient" \x02You have to wear\x04 %s\x01 on your name to use this command!"SuperWord )
            return 
Plugin_Handled
        
}
    }
    
    
decl StringChoosenTag32 ]
    
GetCmdArgStringChoosenTagsizeofChoosenTag ) )
    
    if( 
args ) {
        
PrintToChatclient"*\x04 Usage:\x02 !tag\x01 <you tag>" )
        return 
Plugin_Handled
    
}
    
    if( 
strlenChoosenTag ) > 15 ) {
        
PrintToChatclient"*\x02 The tag you have choosen is too long. The tag can be 12 characters long!" )
        return 
Plugin_Handled
    
}
    
    if( 
GetConVarIntCheckTags ) > ) {
        
decl StringBannedTags1024 ]
        
        for( new 
0GetArraySizeRestrictedTags ); i++ ) {
            
GetArrayStringRestrictedTagsiBannedTagssizeofBannedTags ) )
            
            if( 
StrContainsChoosenTagBannedTags ) != -) {
                
PrintToChatclient"*\x02 Your tag or a part of it is forbidden, please choose another tag!" )
                return 
Plugin_Handled
            
}
        }
    }
    
    
CS_SetClientClanTagclientChoosenTag )
    
SetClientCookieclientClientTagChoosenTag )
    
    if( 
GetConVarIntPrintTagAssign ) > ) {
        
PrintToChatclient"*\x09 Your tag has been succesifull modified!" )
        
PrintToChatclient"*\x09 Your new tag is\x04 %s"ChoosenTag )
    }
    
    return 
Plugin_Continue
}

public 
ActionCommand_AssignTagColorclientargs ) {
    if( 
args ) {
        
PrintToChatclient"*\x04 Usage:\x02 !tagcolor\x01 <color>\x04 - type\x02 !tagcolorsinfo\x01 for more info" )
        return 
Plugin_Handled
    
}
    
    
decl StringColor32 ]
    
GetCmdArg1ColorsizeofColor ) )
    
    if( 
StrEqualColor"team" ) ) {
        
SetClientCookieclientClientTagColor"" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"* Your tag color is now team color!" )
        }
    }
    else if( 
StrEqualColor"white" ) ) {
        
SetClientCookieclientClientTagColor"\x01" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"* Your tag color is now white!" )
        }
    }
    else if( 
StrEqualColor"red" ) ) {
        
SetClientCookieclientClientTagColor"\x07" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"* Your tag color is now\x07 red!" )
        }
    }
    else if( 
StrEqualColor"darkred" ) ) {
        
SetClientCookieclientClientTagColor"\x02" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"* Your tag color is now\x02 darkred!" )
        }
    }
    else if( 
StrEqualColor"lightred" ) ) {
        
SetClientCookieclientClientTagColor"\x0F" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"* Your tag color is now \x0Flightred!" )
        }
    }
    else if( 
StrEqualColor"green" ) ) {
        
SetClientCookieclientClientTagColor"\x04" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"* Your tag color is now \x04green!" )
        }
    }
    else if( 
StrEqualColor"lightgreen" ) ) {
        
SetClientCookieclientClientTagColor"\x05" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"* Your tag color is now \x05lightgreen!" )
        }
    }
    else if( 
StrEqualColor"lime" ) ) {
        
SetClientCookieclientClientTagColor"\x06" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"* Your tag color is now \x06lime!" )
        }
    }
    else if( 
StrEqualColor"purple" ) ) {
        
SetClientCookieclientClientTagColor"\x03" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"* Your tag color is now \x03purple!" )
        }
    }
    else if( 
StrEqualColor"grey" ) ) {
        
SetClientCookieclientClientTagColor"\x08" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"* Your tag color is now \x08grey!" )
        }
    }
    else if( 
StrEqualColor"grey2" ) ) {
        
SetClientCookieclientClientTagColor"\x0A" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"* Your tag color is now \x0Agrey2!" )
        }
    }
    else if( 
StrEqualColor"grey3" ) ) {
        
SetClientCookieclientClientTagColor"\x0D" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"* Your tag color is now \x0Dgrey3!" )
        }
    }
    else if( 
StrEqualColor"yellow" ) ) {
        
SetClientCookieclientClientTagColor"\x09" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"* Your tag color is now \x09yellow!" )
        }
    }
    else if( 
StrEqualColor"blue" ) ) {
        
SetClientCookieclientClientTagColor"\x0C" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"* Your tag color is now \x0Cblue!" )
        }
    }
    else if( 
StrEqualColor"lightblue" ) ) {
        
SetClientCookieclientClientTagColor"\x0B" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"* Your tag color is now \x0Blightblue!" )
        }
    }
    else if( 
StrEqualColor"pink" ) ) {
        
SetClientCookieclientClientTagColor"\x0E" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"* Your tag color is now \x0Epink!" )
        }
    }
    else if( 
StrEqualColor"orange" ) ) {
        
SetClientCookieclientClientTagColor"\x10" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"* Your tag color is now \x10orange!" )
        }
    }
    else {
        
PrintToChatclient"*\x02 Given color is invalid!" )
        return 
Plugin_Handled
    
}
    
    return 
Plugin_Continue
}

public 
ActionCommand_ShowColorInfoclientargs ) {
    
PrintToChatclient"*\x01 Available colors are:" )
    
PrintToChatclient"white, \x07red \x02darkred, \x0Flightred \x03purple, \x04green, \x05lightgreen, \x06lime, \x08grey, \x0Agrey2, \x0Dgrey3 \x09yellow, \x0Blightblue, \x0Cblue, \x0Epink, \x10orange, \x01team" )
}

public 
ActionCP_OnChatMessageintclientArrayList recipientschar[] flagstringchar[] namechar[] messageboolprocesscolorsboolremovecolors ) {
    if( 
GetConVarIntOnlyAdmins ) > ) {
        if( !
CheckCommandAccessclient"sm_someoverride"flag ) ) {
            return 
Plugin_Continue
        
}
    }
    
    
decl StringTag32 ]
    
GetClientCookieclientClientTagTagsizeofTag ) )
    
    
decl StringColor32 ]
    
GetClientCookieclientClientTagColorColorsizeofColor ) )
    
    if( 
StrEqualTag"" ) ) {
        return 
Plugin_Continue
    
}
    
    if( 
strlenColor ) > ) {
        switch( 
GetClientTeamclient ) ) {
            case 
CS_TEAM_NONE: {
                
FormatnameMAXLENGTH_NAME" %s%s\x01 %s"ColorTagname )
            }
            case 
CS_TEAM_SPECTATOR: {
                
FormatnameMAXLENGTH_NAME" %s%s\x01 %s"ColorTagname )
            }
            case 
CS_TEAM_T: {
                
FormatnameMAXLENGTH_NAME" %s%s\x09 %s"ColorTagname )
            }
            case 
CS_TEAM_CT: {
                
FormatnameMAXLENGTH_NAME" %s%s\x0B %s"ColorTagname )
            }
        }
    }
    else {
        
FormatnameMAXLENGTH_NAME"%s %s"Tagname )
    }
    
    
FormatmessageMAXLENGTH_MESSAGE"%s"message )
    
    return 
Plugin_Continue
}

public 
ActionCommand_DisableTagclientargs ) {
    if( 
IsClientInGameclient ) && client && client <= MaxClients ) {
        
SetClientCookieclientClientTag"" )
        
CS_SetClientClanTagclient"" )
        
        if( 
GetConVarIntPrintTagAssign ) > ) {
            
PrintToChatclient"*\x02 Your tag has been disabled!" )
        }
    }
}

public 
ActionTagTheClientHandletimeranyclient ) {
    if( 
IsClientInGameclient ) && client && client <= MaxClients ) {
        
decl StringTag32 ]
        
GetClientCookieclientClientTagTagsizeofTag ) )
        
        if( 
strlenTag ) > ) {
            if( 
GetConVarIntCheckTags ) > ) {
                
decl StringTagsFromFile1024 ]
                
                for( new 
0GetArraySizeRestrictedTags ); i++ ) {
                    
GetArrayStringRestrictedTagsiTagsFromFilesizeofTagsFromFile ) )
                    
                    if( 
StrContainsTagTagsFromFile ) != -) {
                        
SetClientCookieclientClientTag"" )
                        
                        if( 
GetConVarIntPrintTagAssign ) > ) {
                            
PrintToChatclient"*\x02 Your tag is forbidden and it has been deleted!" )
                        }
                    }
                    else {
                        
CS_SetClientClanTagclientTag )
                    }
                }
            }
            else {
                
CS_SetClientClanTagclientTag )
            }
        }
    }
}

public 
ReadForbiddenTags( ) {
    
RestrictedTags CreateArray1024 )
    
    
BuildPathPath_SMRestrictedTagsFilesizeofRestrictedTagsFile ), "configs/RestrictedTags.txt" )
    new 
HandleRestrictedTagsHolder OpenFileRestrictedTagsFile"r" )
    
    new 
StringResultsBuffer1024 ]
    
    while( !
IsEndOfFileRestrictedTagsHolder ) && ReadFileLineRestrictedTagsHolderResultsBuffersizeofResultsBuffer ) ) ) {
        
ReplaceStringResultsBuffersizeofResultsBuffer ), "\n"""false )
        
PushArrayStringRestrictedTagsResultsBuffer )
    }


Last edited by combocarte112; 04-13-2020 at 03:27.
combocarte112 is offline
Send a message via Skype™ to combocarte112
Reply


Thread Tools
Display Modes

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 00:00.


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