AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   immunity to change tag admin (https://forums.alliedmods.net/showthread.php?t=89611)

algoasi 04-08-2009 11:05

immunity to change tag admin
 
I have this script. but I do not want to change the name of the admin?

can you help?:wink:



PHP Code:

#include <amxmodx> 

PHP Code:

[left]#include <amxmisc>#define PLUGIN "TAGNAME"
#define VERSION "1.0"
#define AUTHOR "algoasi"
public plugin_init()
   
register_plugin(PLUGINVERSIONAUTHOR)public client_putinserver(id)
   
set_task(3.0,"change",id);
   
public 
change(id)
{
   if(!
is_user_connected(id))
      return 
0;
     
   new 
name[32], buffer[32];
   
get_user_name(id,name,31);
   
   if(
containi(name,"[tag]") != -1)
      return 
0;
     
   
formatex(buffer,sizeof buffer 1"[tag] *%s"name);
   
client_cmd(id"name ^"%s^""buffer);
   
   return 
1;
}public 
client_infochangedid )
{
   new 
newname32 ], oldname32 ], buffer[32];
   
get_user_info(id"name"newname31 );
   
get_user_name(idoldname31 );
   
   if(
equalinewnameoldname ) )
      return 
PLUGIN_CONTINUE;
     
   if(
containi(newname,"[tag]") != -1)
      return 
PLUGIN_CONTINUE;
     
   
formatex(buffer,sizeof buffer 1"[tag] *%s"newname);
   
client_cmd(id"name ^"%s^""buffer);
   
   return 
PLUGIN_CONTINUE;
}[/
left


fysiks 04-08-2009 11:21

Re: immunity to change tag admin
 
PHP Code:

if(!is_user_connected(id))
{
    return
}
if(
is_user_admin(id))
{
    return


You must make sure all users are connected because nobody will have admin before that returns true.

algoasi 04-08-2009 11:39

Re: immunity to change tag admin
 
mnmn! not work for me


I do not understand

hleV 04-08-2009 13:36

Re: immunity to change tag admin
 
Code:
   if(!is_user_connected(id) || (get_user_flags(id) & ADMIN_IMMUNITY))       return 0;

algoasi 04-08-2009 22:35

Re: immunity to change tag admin
 
work! ...
but I want you all to admin flags. not only "a"

Bugsy 04-08-2009 23:03

Re: immunity to change tag admin
 
PHP Code:

if( !is_user_connected(id) || is_user_admin(id) )
      return 
PLUGIN_CONTINUE


algoasi 04-11-2009 09:51

Re: immunity to change tag admin
 
excellent!:mrgreen:

but I have a new idea. hope you can help me

a file (txt, ini, cfg) for the names immune the tag

example:

look at this



Quote:

//These people do not have the tag

Pamela.
Shakira
Obama
Bush.
Maria
Bill gate$
Blaise Pascal




You can help me with this

Bugsy 04-11-2009 10:20

Re: immunity to change tag admin
 
So you want the players with those exact names to be immune?

algoasi 04-11-2009 11:47

Re: immunity to change tag admin
 
exactly bro, please help me with this. be 100% grateful for your help

Bugsy 04-11-2009 12:16

Re: immunity to change tag admin
 
In your amxmodx\configs dir place a file named "immune_names.txt" in the below format.

Code:

name1
name2
name3
name4

See below for extra options
PHP Code:

public CheckNameid )
{
    if ( !
is_user_connected(id) )
        return 
PLUGIN_HANDLED;
        
    new 
szNamesFile[64];
    new 
szItem[33];
    new 
szName[33];

    
get_configsdir(szNamesFile63);
    
formatszNamesFile 63 "%s/immune_names.txt" szNamesFile );

    if ( !
file_existsszNamesFile ) )
        return 
0;

    new 
iFile fopen szNamesFile "r" );

    
get_user_nameid szName 32 );
    
    while ( !
feofiFile ) )
    {
        
fgetsiFile ,  szItem 32 );
        
        if ( 
equalszNameszItem strlen(szName) ) )
        {
            
fcloseiFile );
            return 
1;
        }
    }
    
    
fcloseiFile );
    
    return 
0;


This function is case sensitive, if you do not want it to not be, change 'equal' to 'equali'
OR
If you want to return true if the file item is found within the players name replace the equal statement with:
PHP Code:

if ( containszNameszItem ) > -)
//OR case insensitive
if ( containiszNameszItem ) > -

Example usage:
PHP Code:

public client_putinserver(id)
{
    if ( 
CheckName(id) )
        
//player is immune since name found
    
else
        
//players name not found
//OR
    
if ( !CheckName(id) )
        
//players name not found
    
else
        
//player is immune




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

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