Thread: User Tag Prefix
View Single Post
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 07-03-2020 , 18:37   Re: User Tag Prefix
Reply With Quote #76

Hi,

First i liked you plugin, Sec: I was want to add Level and rank to chat codes and i did it but it's working only for who have tag so "level and rank" cant show only if i have tag access, but i did it before in adminprefix v4.0 and working without anyproblem but that version is not good, can you tell me how to do that ? or can you did it for me plz.

What i did:
PHP Code:
public user_cmd_saytext(msgidmsgdestentity_id)
{
    new 
id get_msg_arg_int(1)
    
    if(
equal(user_prefix[id], "DISABLED254358") || !g_user_prefix[id] || !is_user_connected(entity_id) || !is_user_connected(id)) return 0
    
    
new sBuffer[256], szArgs[192], szChannel[24], szStats[8]
    
    new 
g_stats get_pcvar_num(g_show_stats)
    new 
is_alive is_user_alive(id)
    
formatex(szStatscharsmax(szStats), "%s", (!g_stats stats_prefix[is_alive]:(g_stats == 1) ? (is_alive "^0":stats_prefix[Udead]):(is_alive stats_prefix[Ualive]:"^0")))
    
    
get_msg_arg_string(4szArgscharsmax(szArgs))
    
get_msg_arg_string(2szChannelcharsmax(szChannel))
    
    new 
strlen(user_prefix[id]), iColor[3];
    
formatex(iColorcharsmax(iColor), "%c%c"user_prefix[id][i-2], user_prefix[id][i-1])
    
    new 
user_name[32]
    
get_user_name(iduser_namecharsmax(user_name))
    
    new 
prefix[32];
    
formatex(prefixcharsmax(prefix), user_prefix[id])
    
    new 
iRank[32]
    
get_user_rank(idiRankcharsmax(iRank))
    
    new 
iLevel get_user_level(id)
    
    if(
equal(szChannel"#Cstrike_Chat_All"16))
    {
        
formatex(sBuffercharsmax(sBuffer), "^4[ ^3Lv.%d ^1-^3 %s ^4] %s%c%s %c%s %c: %s%s"iLeveliRankszStats'^4'prefix,
        
'^3'user_name'^4'iColorszArgs)
    }
    else
    {
        
formatex(sBuffercharsmax(sBuffer), "^4[ ^3Lv.%d ^1-^3 %s ^4] %s%c%s %c%s %c%s %c: %s%s"iLeveliRankszStats'^3'team_prefix[get_user_team(id)],
        
'^4'prefix'^3'user_name'^4'iColorszArgs)
    }
    
    
chat_message(MSG_ONEentity_ididsBuffer)
    return 
1

Adminprefix v4.0:

PHP Code:
public HookSay(id)
{
    
read_args(g_typedcharsmax(g_typed))
    
remove_quotes(g_typed)

    
trim(g_typed)

    if(
equal(g_typed"") || !is_user_connected(id))
        return 
PLUGIN_HANDLED_MAIN

    
if(equal(g_typed"/prefix"))
    {
        if(
g_toggle[id])
        {
            
g_toggle[id] = false
            client_print
(idprint_chat"%L"LANG_SERVER"PREFIX_OFF"in_prefix)
        }
        else
        {
            
g_toggle[id] = true
            client_print
(idprint_chat"%L"LANG_SERVER"PREFIX_ON"in_prefix)
        }

        return 
PLUGIN_HANDLED_MAIN
    
}

    if(!
g_toggle[id])
        return 
PLUGIN_CONTINUE

    num_to_str
(idstr_idcharsmax(str_id))

    if((
TrieGetString(client_prefixstr_idtemp_prefixcharsmax(temp_prefix)) && get_pcvar_num(g_say_characters) == 1) || (!TrieGetString(client_prefixstr_idtemp_prefixcharsmax(temp_prefix)) && get_pcvar_num(g_say_characters) == 2) || get_pcvar_num(g_say_characters) == 3)
    {
        if(
check_say_characters(g_typed))
            return 
PLUGIN_HANDLED_MAIN
    
}

    
get_user_name(idg_namecharsmax(g_name))

    
g_team cs_get_user_team(id)

    new 
pos0
    
while ( g_swearsNum )
    {
    if ( (
pos containi(g_typed,g_swearsNames[i][1])) != -){ 
        new 
len g_swearsNames[i][0
        while(
len--)
        
g_typed[pos++] = '*'
        
continue
    }
    ++
i
    
}

    if(
temp_prefix[0])
    {
        
formatex(g_messagecharsmax(g_message), "^1%s^4[LV. %d] ^4%s^3 %s :^4 %s"say_team_info[is_user_alive(id)][g_team], get_user_level(id), temp_prefixg_nameg_typed)
    }
    else
    {
        
formatex(g_messagecharsmax(g_message), "^1%s^4[LV. %d]^3 %s :^1 %s"say_team_info[is_user_alive(id)][g_team], get_user_level(id), g_nameg_typed)
    }

    for(new 
1<= g_maxplayersi++)
    {
        if(!
is_user_connected(i))
            continue
        
        
send_message(g_messageidi)
    }

    return 
PLUGIN_HANDLED_MAIN

Supremache is offline