View Single Post
Nyuszy
Senior Member
Join Date: Apr 2009
Old 04-09-2011 , 05:33   Re: [REQ] /tag /untag plugin
Reply With Quote #4

PHP Code:
#include <amxmodx>

new bool:ptag[33]
new 
cvar_tag

public plugin_init()
{
    
register_clcmd("say /tag""add_tag")
    
register_clcmd("say /untag""remove_tag")
    
    
cvar_tag register_cvar("amx_tag""[tag]")
}

public 
client_connect(id)        // check if player has tag on connect
{
    new 
tag[32], name[65], temp[32]
    
get_pcvar_string(cvar_tagtag31)
    
get_user_name(idname64)
    
copy(tempstrlen(tag), name)
    if(
equali(temptag))
    {
        
ptag[id] = true
    
}
    else
    {
        
ptag[id] = false
    
}
}

public 
add_tag(id)
{
    if(!
ptag[id])
    {
        new 
tag[32], name[65], newname[65]
        
get_pcvar_string(cvar_tagtag31)
        
get_user_name(idname64)
        
format(newname64"%s %s"tagname)
        
set_user_info(id"name"newname)
        
ptag[id] = true
    
}
    return 
PLUGIN_HANDLED
}

public 
remove_tag(id)
{
    if(
ptag[id])
    {
        new 
tag[32], name[65]
        
get_pcvar_string(cvar_tagtag31)
        
get_user_name(idname64)
        if(
equali(name[strlen(tag)+1], " ")) // if there is a space between tag and name
        
{
            
format(tag64"%s "tag)
        }
        
replace(namestrlen(tag), tag"")
        
set_user_info(id"name"name)
        
ptag[id] = false
    
}
    return 
PLUGIN_HANDLED

try this

Last edited by Nyuszy; 04-09-2011 at 05:35.
Nyuszy is offline