Raised This Month: $ Target: $400
 0% 

help me add admin flag to this plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vi3tmofo
Member
Join Date: Jun 2009
Old 04-10-2011 , 01:27   help me add admin flag to this plugin
Reply With Quote #1

hi guys i seem to can not figure out how to add admin flag to this plugin tagprotect.amxx , i want to add a flag access , like if admin have the access level b, i dont want everyone with admin have the tags, it will force them to tag. here is the sma files if u can help me.


#include <amxmodx>
#include <amxmisc>
public plugin_init()
{
register_plugin("Admin Tag Enforcement/Protection", "1", "atambo")
register_cvar("amx_taginfront", "1")
register_cvar("amx_tagprotect", "1")
register_cvar("amx_clantag", "none")
}
public client_putinserver(id)
set_task(1.5,"admin_entered",id)
public admin_entered(id)
{
new name[32]
get_user_name(id, name, 31)
return force_tag(id, name)
}
force_tag(id, name[])
{
new clantag[24]
get_cvar_string("amx_clantag",clantag,23)
if(get_cvar_num("amx_tagprotect") == 0)
return PLUGIN_CONTINUE
if(get_cvar_num("amx_taginfront") == 1)
{
if(is_user_admin(id) && (containi(name, clantag)<0) && (!access(id, ADMIN_IMMUNITY)))
{
copy(name,23,name)
client_cmd(id,"name ^"%s%s^"",clantag,name)
}
if((!is_user_admin(id)) && (containi(name, clantag)>=0))
{
deletei(name, clantag)
trim(name)
if(strlen(name) == 0)
copy(name, 7, "Player")
client_cmd(id, "name ^"%s^"", name)
}
return PLUGIN_CONTINUE
}
else
{
if(is_user_admin(id) && (containi(name, clantag)<0) && (!access(id, ADMIN_IMMUNITY)))
{
copy(name,23,name)
client_cmd(id,"name ^"%s%s^"",name,clantag)
}
if((!is_user_admin(id)) && (containi(name, clantag)>=0))
{
deletei(name, clantag)
trim(name)
if(strlen(name) == 0)
copy(name, 7, "Player")
client_cmd(id, "name ^"%s^"", name)
}
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public client_infochanged(id)
{
new name[32]
get_user_info(id, "name", name, 31)
return force_tag(id, name)
}
deletei(text[], const what[])
{
new pos
new len
new i
pos = containi(text, what)
while (pos>=0)
{
len = strlen(what)
i = 0
while (text[pos+len+i]!=0)
{
text[pos+i] = text[pos+len+i]
i++
}
text[pos+i] = 0
pos = containi(text, what)
}
}
vi3tmofo is offline
Nyuszy
Senior Member
Join Date: Apr 2009
Old 04-10-2011 , 04:14   Re: help me add admin flag to this plugin
Reply With Quote #2

try to edit this: http://forums.alliedmods.net/showpos...90&postcount=4
Nyuszy is offline
vi3tmofo
Member
Join Date: Jun 2009
Old 04-10-2011 , 10:51   Re: help me add admin flag to this plugin
Reply With Quote #3

nope did not help. im trying to add a flag acess soo admin with letter B in access can only be force to tag.
vi3tmofo is offline
Nyuszy
Senior Member
Join Date: Apr 2009
Old 04-10-2011 , 11:03   Re: help me add admin flag to this plugin
Reply With Quote #4

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

new cvar_tag

public plugin_init()
{    
    
cvar_tag register_cvar("amx_tag""[tag]")
}

public 
client_connect(id)
{
    
check_tag(id)
}

public 
client_infochanged(id)
{
    
check_tag(id)
}

check_tag(id)
{
    new 
tag[32], name[65], temp[32]
    
get_pcvar_string(cvar_tagtag31)
    
get_user_name(idname64)
    
copy(tempstrlen(tag), name)
    if(
equali(temptag))
    {
        if(!
is_user_admin(id))
        {
            
remove_tag(id)
        }
    }
    else
    {
        if(
is_user_admin(id))
        {
            
add_tag(id)
        }
    }
}

add_tag(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)
}

remove_tag(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)

Nyuszy is offline
vi3tmofo
Member
Join Date: Jun 2009
Old 04-10-2011 , 12:01   Re: help me add admin flag to this plugin
Reply With Quote #5

where do i add the acess B. or c, for other admins. the problem is that anyone have admin will force tag. i just want a certain letter of access like B
vi3tmofo is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-10-2011 , 16:26   Re: help me add admin flag to this plugin
Reply With Quote #6

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

#define ACCESS_LEVEL ADMIN_RESERVATION

new cvar_tag

public plugin_init()
{    
    
cvar_tag register_cvar("amx_tag""[tag]")
}

public 
client_connect(id)
{
    
check_tag(id)
}

public 
client_infochanged(id)
{
    
check_tag(id)
}

check_tag(id)
{
    new 
tag[32], name[65], temp[32]
    
get_pcvar_string(cvar_tagtag31)
    
get_user_name(idname64)
    
copy(tempstrlen(tag), name)
    if(
equali(temptag))
    {
        if(!
access(idACCESS_FLAG))
        {
            
remove_tag(id)
        }
    }
    else
    {
        if(
access(idACCESS_FLAG))
        {
            
add_tag(id)
        }
    }
}

add_tag(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)
}

remove_tag(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)

Change ACCESS_FLAG to whatever flag you need.
For the list of admin flag constants, look here: http://www.amxmodx.org/funcwiki.php?...=1#const_admin
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
vi3tmofo
Member
Join Date: Jun 2009
Old 04-11-2011 , 22:28   Re: help me add admin flag to this plugin
Reply With Quote #7

hey, exolent. thanks for the scripting. but it have a couple problem, like it only change the tag when u connect only, but once ur in game u change the nick in game it does not alot tag it back. can u set it where in game if u change the name to any name it will auto have the tag in front of the name again.
vi3tmofo is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-11-2011 , 22:30   Re: help me add admin flag to this plugin
Reply With Quote #8

Quote:
Originally Posted by vi3tmofo View Post
hey, exolent. thanks for the scripting. but it have a couple problem, like it only change the tag when u connect only, but once ur in game u change the nick in game it does not alot tag it back. can u set it where in game if u change the name to any name it will auto have the tag in front of the name again.
You didn't like my version of "Clan Tag Protection" in the other thread that you started?
__________________
fysiks is offline
vi3tmofo
Member
Join Date: Jun 2009
Old 04-11-2011 , 22:31   Re: help me add admin flag to this plugin
Reply With Quote #9

what thread fysik i didnt see it. can u post it here.
vi3tmofo is offline
vi3tmofo
Member
Join Date: Jun 2009
Old 04-11-2011 , 22:43   Re: help me add admin flag to this plugin
Reply With Quote #10

i tried it fys it didnt work
vi3tmofo 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 19:45.


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