AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Name / Tag Protection Script (https://forums.alliedmods.net/showthread.php?t=102443)

Kitami 09-02-2009 13:59

Name / Tag Protection Script
 
This is the plugin made from atambo, all I'm trying to do is remove the admin immunity so that it also forces admins with immunity to wear the tag.

I've tried to just delete the "ADMIN_IMMUNITY" but that gives me 12 errors LOL.

In my ideal setup I wanted a plugin that removes the tag from people who are not listed in a .ini and forces people in the .ini to wear the tag. I've looked around and I cant find anything like that I can find a plugin that does one thing but not the other and vise versa.

This one has the code to remove the tag and force the tag on admins / non admins.
http://forums.alliedmods.net/showthread.php?p=160621

This one doesn't force people and anyone can wear the tag but it uses a .ini
http://forums.alliedmods.net/showthread.php?p=126586

I don't need anything fancy no kicking or anything like that maybe a message to the person saying they are not allowed to wear the tag.

Thanks so much guys :)




Code:

#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)
        }
}


DarkGod 09-03-2009 07:36

Re: Name / Tag Protection Script
 
Code:
#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))         {             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))         {             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)     } }
I haven't tried it out but it compiles just fine.

Kitami 09-04-2009 18:34

Re: Name / Tag Protection Script
 
I compiled and tested the plugin it still does not force admins to wear the tag.

DarkGod 09-05-2009 05:10

Re: Name / Tag Protection Script
 
I just tested it myself and it gave me the tag all the time if I had any flag (including immunity, not including 'z').
Are you sure that you replaced the old plugin after you compiled?

Kitami 09-05-2009 16:30

Re: Name / Tag Protection Script
 
You must be right I just loaded it on my local server and it worked, sorry for being such an idiot.


All times are GMT -4. The time now is 15:15.

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