Raised This Month: $ Target: $400
 0% 

[REQ] Tag Admin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
plazma
Senior Member
Join Date: Oct 2013
Old 05-27-2014 , 09:05   [REQ] Tag Admin
Reply With Quote #1

How to make this ex:

in file .ini


plazma = Tag Here
Plazzma 123 = Tag Here


sma

PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < cstrike >

new g_iMsgID_SayText;

new 
g_iAdminChatFlag ADMIN_ALL;

new 
g_szTags[5][10];
new 
Trie:g_tSteamTagIndex;
new 
g_iPlayerTag[33]

public 
plugin_init( )
{
    
register_plugin("pepe_thugs Chat Tags""0.2""Fysiks")
    
register_clcmd"say""CmdSay" );
    
register_clcmd"say_team""CmdSayTeam" );
    
    
g_iMsgID_SayText get_user_msgid"SayText" );
    
    new 
szCommand32 ], iFlags;
    for( new 
0get_concmdiszCommandcharsmaxszCommand ), iFlags""00, -); i++ )
    {
        if( 
equalszCommand"amx_chat" ) )
        {
            
g_iAdminChatFlag iFlags;
            break;
        }
    }
    
    
g_tSteamTagIndex TrieCreate();
    
loadTags();
}

public 
client_connect(id)
{
    
g_iPlayerTag[id] = 0;
}

public 
client_authorized(id)
{
    new 
szSteamID[32];
    
get_user_authid(idszSteamIDcharsmax(szSteamID));
    
TrieGetCell(g_tSteamTagIndexszSteamIDg_iPlayerTag[id] )
}

public 
CmdSayiPlayer )
{
    if( !
g_iPlayerTag[iPlayer] )
    {
        return 
PLUGIN_CONTINUE;
    }

    if( !
is_user_connectediPlayer ) )
    {
        return 
PLUGIN_HANDLED_MAIN;
    }
    
    new 
szArgs194 ];
    
    if( !
IsValidMessageiPlayerfalseszArgscharsmaxszArgs ) ) )
    {
        return 
PLUGIN_HANDLED_MAIN;
    }
    
    new 
iAlive is_user_aliveiPlayer );
    new 
CsTeams:iTeam cs_get_user_teamiPlayer );
    
    new 
iPlayers32 ], iNum;
    
get_playersiPlayersiNum );
    
    new 
szName32 ];
    
get_user_nameiPlayerszNamecharsmaxszName ) );
    
    new const 
szPrefixes][ CsTeams ][ ] =
    {
        {
            
"^1*DEAD* ",
            
"^1*DEAD* ",
            
"^1*DEAD* ",
            
"^1*SPEC* "
        
},
        {
            
"",
            
"",
            
"",
            
""
        
}
    };
    
    new 
szMessage192 ];
    
formatexszMessagecharsmaxszMessage ), "^4%s ^1%s^3%s^1 :  %s"g_szTags[g_iPlayerTag[iPlayer]], szPrefixesiAlive ][ iTeam ], szNameszArgs );
    
    new 
iTarget;
    for( new 
0iNumi++ )
    {
        
iTarget iPlayers];
        
        if( 
iTarget == iPlayer || ( iAlive || is_user_connectediTarget ) ) && is_user_aliveiTarget ) == iAlive )
        {
            
message_beginMSG_ONE_UNRELIABLEg_iMsgID_SayText_iTarget );
            
write_byteiPlayer );
            
write_stringszMessage );
            
message_end( );
        }
    }
    
    return 
PLUGIN_HANDLED_MAIN;
}

public 
CmdSayTeamiPlayer )
{
    if( !
g_iPlayerTag[iPlayer] )
    {
        return 
PLUGIN_CONTINUE;
    }

    if( !
is_user_connectediPlayer ) )
    {
        return 
PLUGIN_HANDLED_MAIN;
    }
    
    new 
szArgs194 ];
    
    if( !
IsValidMessageiPlayertrueszArgscharsmaxszArgs ) ) )
    {
        return 
PLUGIN_HANDLED_MAIN;
    }
    
    new 
iAlive is_user_aliveiPlayer );
    new 
CsTeams:iTeam CsTeams:( ( _:cs_get_user_teamiPlayer ) ) % );
    
    new 
iPlayers32 ], iNum;
    
get_playersiPlayersiNum );
    
    new 
szName32 ];
    
get_user_nameiPlayerszNamecharsmaxszName ) );
    
    new const 
szPrefixes][ CsTeams ][ ] =
    {
        {
            
"(Spectator)",
            
"*DEAD*(Terrorist)",
            
"*DEAD*(Counter-Terrorist)",
            
""
        
},
        {
            
"(Spectator)",
            
"(Terrorist)",
            
"(Counter-Terrorist)",
            
""
        
}
    };
    
    new 
szMessage192 ];
    
formatexszMessagecharsmaxszMessage ), "^4%s ^1%s^3 %s^1 :  %s"g_szTags[g_iPlayerTag[iPlayer]], szPrefixesiAlive ][ iTeam ], szNameszArgs );
    
    for( new 
0iTeammateiNumi++ )
    {
        
iTeammate iPlayers];
        
        if( 
iTeammate == iPlayer || ( iAlive || is_user_connectediTeammate ) ) && is_user_aliveiTeammate ) == iAlive && CsTeams:( ( _:cs_get_user_teamiTeammate ) ) % ) == iTeam )
        {
            
message_beginMSG_ONE_UNRELIABLEg_iMsgID_SayText_iTeammate );
            
write_byteiPlayer );
            
write_stringszMessage );
            
message_end( );
        }
    }
    
    return 
PLUGIN_HANDLED_MAIN;
}

bool:IsValidMessageiPlayerbool:bTeamSayszMessage[ ], iLen )
{
    
read_argsszMessageiLen );
    
remove_quotesszMessage );

    if( !
szMessage] )
    {
        return 
false;
    }
    
    new 
iPoscChari;
    while( ( 
cChar szMessageiPos ] ) == '@' )
    {
        
i++;
        
iPos++;
    }

    if( 
)
    {
        return ( !( 
bTeamSay ? ( == ) : ( <= <= ) ) || !accessiPlayerg_iAdminChatFlag ) );
    }

    while( 
< ( cChar szMessageiPos++ ] ) <= 255 )
    {
        if( 
cChar != ' ' && cChar != '%' )
        {
            return 
true;
        }
    }

    return 
false;
}

loadTags()
{
    
// load tags from file
    
new szFilePath[128];
    
get_configsdir(szFilePathcharsmax(szFilePath));
    
add(szFilePathcharsmax(szFilePath), "/Admintags.ini");
    
    new 
fopen(szFilePath"rt");
    
    if( !
)
    {
        new 
szMessage[128];
        
formatex(szMessagecharsmax(szMessage), "Unable to open %s"szFilePath);
        
set_fail_state(szMessage);
    }
    
    new 
data[32], iTagCount;
    while( !
feof(f) )
    {
        
fgets(fdatacharsmax(data))
        
        
trim(data);
        if( !
data[0] || data[0] == ';' || data[0] == '/' && data[1] == '/' ) continue;
        
        if( 
data[0] == '[' )
        {
            
iTagCount++
            
copy(g_szTags[iTagCount], charsmax(g_szTags[]), data)
        }
        else
        {
            
TrieSetCell(g_tSteamTagIndexdataiTagCount)
        }
    }
    
fclose(f)

__________________
Free Palestine ♥
plazma is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-27-2014 , 10:51   Re: [REQ] Tag Admin
Reply With Quote #2

It already uses a .ini file. Simply use it as it is.

Don't post the code when it already exists in another post. Simply post a link to the post. Also, the Scripting Help forum is for people who are going to write the code themselves. If you are not going to do the writing of the code, post in the Suggestions/Requests forum.
__________________

Last edited by fysiks; 05-27-2014 at 10:55.
fysiks is offline
plazma
Senior Member
Join Date: Oct 2013
Old 05-27-2014 , 11:08   Re: [REQ] Tag Admin
Reply With Quote #3

Upss sory, but you can't help me ??
__________________
Free Palestine ♥
plazma is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 05-27-2014 , 12:52   Re: [REQ] Tag Admin
Reply With Quote #4

I don't even understand the question. What's wrong with it as it is now?
__________________
Black Rose is offline
plazma
Senior Member
Join Date: Oct 2013
Old 05-27-2014 , 13:10   Re: [REQ] Tag Admin
Reply With Quote #5

Quote:
Originally Posted by Black Rose View Post
I don't even understand the question. What's wrong with it as it is now?
Bro make this script with admin tag in file Admintags.ini example:

plazma = Tag Here
Plazma123 = tag Here

You understand now... ?
__________________
Free Palestine ♥

Last edited by plazma; 05-27-2014 at 13:12.
plazma is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 05-27-2014 , 13:13   Re: [REQ] Tag Admin
Reply With Quote #6

But that is what it does already?
__________________
Black Rose is offline
plazma
Senior Member
Join Date: Oct 2013
Old 05-27-2014 , 13:18   Re: [REQ] Tag Admin
Reply With Quote #7

Quote:
Originally Posted by Black Rose View Post
But that is what it does already?
No it did, it only works with Steam ID

ex:
Code:
[Leader]
STEAM_0:0:12345
STEAM_0:0:23456

[MODS]
STEAM_0:0:34567
STEAM_0:0:45678
But I want to work so

plazma = tag here (name of admin, and tag)
....
__________________
Free Palestine ♥

Last edited by plazma; 05-27-2014 at 13:20.
plazma is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-27-2014 , 15:52   Re: [REQ] Tag Admin
Reply With Quote #8

SteamID is the only reliable/supported method.
__________________
fysiks is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 05-27-2014 , 16:18   Re: [REQ] Tag Admin
Reply With Quote #9

Quote:
Originally Posted by plazma View Post
No it did, it only works with Steam ID

ex:
Code:
[Leader]
STEAM_0:0:12345
STEAM_0:0:23456

[MODS]
STEAM_0:0:34567
STEAM_0:0:45678
But I want to work so

plazma = tag here (name of admin, and tag)
....
Asking for support against non-steam servers is against the forum rules.
__________________
Black Rose 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 09:48.


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