Raised This Month: $51 Target: $400
 12% 

[GUIA] Agregar Inmunidades en tipos de Admins


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
MexPower
Veteran Member
Join Date: Nov 2012
Old 08-12-2013 , 16:00   [GUIA] Agregar Inmunidades en tipos de Admins
#1

Buenas En esta guia les enseñare como agregar inmunidad a los diferentes tipos de admin!
Primero abriremos el plugin admincmd.sma

Debajo de las includes
PHP Code:
#include <amxmodx>
#include <amxmisc> 
Aremos un enum

PHP Code:
enum
{
    
    
PLAYER 0,
    
ADMIN_BASICO//1
    
ADMIN_FULL//2
    
ADMIN_VIP//3 
    
ADMIN_DUENO // 4
}

new 
g_AdminType[33//Variable donde guardaremos que tipo de admin es 
En los enums si se sentencia solo "enum" se va ir aumentando de uno en uno

Ahora dejabo de client_disconnect
PHP Code:
//Cuando el usuario se desconecta
public client_disconnect(id)
{
    if (!
is_user_bot(id))
    {
        
InsertInfo(id);
    }

Agregaremos esto
PHP Code:
//Cuando entra en el servidor
public client_putinserver(id)
{
    if(
is_user_admin(id)) //Chequeamos si es admin
    
{
        if(
get_user_flags(id) & ADMIN_RCON//Si tiene la flag L
            
g_AdminType[id] = ADMIN_DUENO
            
        
else if(get_user_flags(id) & ADMIN_IMMUNITY//Si tiene la flag a
            
g_AdminType[id] = ADMIN_VIP
            
        
else if(get_user_flags(id) & ADMIN_LEVEL_C//Si tiene la flag o
            
g_AdminType[id] = ADMIN_FULL
        
else //Si no tiene niuno de las de arriba
            
g_AdminType[id] = ADMIN_BASICO
            
        
//Recuerden que deben de ir de mayor a menor porque lleva un orden primero chequeamos si 
        //tiene las mejores a las menores
    
}
    else 
//si no es admin
        
g_AdminType[id] = PLAYER    

Ahora para ponerle inmunidad en un ban seria aca
PHP Code:
 public cmdBan(idlevelcid
Para quitar que conque tengan inmunidad sean inmune a todo solo cambiaremos
PHP Code:
 new player cmd_target(idtargetCMDTARGET_OBEY_IMMUNITY CMDTARGET_NO_BOTS CMDTARGET_ALLOW_SELF
por
PHP Code:
new player cmd_target(idtargetCMDTARGET_NO_BOTS CMDTARGET_ALLOW_SELF
y listo
Ahora Debajo de
PHP Code:
if (!player)
    return 
PLUGIN_HANDLED 
Agregaremos esto abajo
PHP Code:
         if(g_AdminType[player] >= g_AdminType[id]) //si su admin es igual o mejor que el de el    
    
{
        
//Le mandamos un mensaje de que no puede hacer esto
        
console_print(id"[AMXX] No puedes Banear a un usuario Con un admin igual o superior al suyo")
        return 
PLUGIN_HANDLED//y detenemos la funcion
    

Y eso seria todo nos quedaria asi
PHP Code:
public cmdBan(idlevelcid)
{
    if (!
cmd_access(idlevelcid3))
        return 
PLUGIN_HANDLED

    
new target[32], minutes[8], reason[64]
    
    
read_argv(1target31)
    
read_argv(2minutes7)
    
read_argv(3reason63)
    
    new 
player cmd_target(idtargetCMDTARGET_NO_BOTS CMDTARGET_ALLOW_SELF)
    
    if (!
player)
        return 
PLUGIN_HANDLED
        
    
if(g_AdminType[player] >= g_AdminType[id])    
    {
        
console_print(id"[AMXX] No puedes Banear a un usuario Con un admin igual o superior al suyo")
        return 
PLUGIN_HANDLED;
    }    

    new 
authid[32], name2[32], authid2[32], name[32]
    new 
userid2 get_user_userid(player)

    
get_user_authid(playerauthid231)
    
get_user_authid(idauthid31)
    
get_user_name(playername231)
    
get_user_name(idname31)
    
    
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")"nameget_user_userid(id), authidname2userid2authid2minutesreason)
    
    new 
temp[64], banned[16], nNum str_to_num(minutes)
    if (
nNum)
        
format(temp63"%L"player"FOR_MIN"minutes)
    else
        
format(temp63"%L"player"PERM")

    
format(banned15"%L"player"BANNED")

    if (
reason[0])
        
server_cmd("kick #%d ^"%(%%s)^";wait;banid ^"%s^" ^"%s^";wait;writeid"userid2reasonbannedtempminutesauthid2)
    else
        
server_cmd("kick #%d ^"%%s^";wait;banid ^"%s^" ^"%s^";wait;writeid"userid2bannedtempminutesauthid2)

    
    
// Display the message to all clients

    
new msg[256];
    new 
len;
    new 
maxpl get_maxplayers();
    for (new 
1<= maxpli++)
    {
        if (
is_user_connected(i) && !is_user_bot(i))
        {
            
len formatex(msgcharsmax(msg), "%L"i"BAN");
            
len += formatex(msg[len], charsmax(msg) - len" %s "name2);
            if (
nNum)
            {
                
len += formatex(msg[len], charsmax(msg) - len"%L"i"FOR_MIN"minutes);
            }
            else
            {
                
len += formatex(msg[len], charsmax(msg) - len"%L"i"PERM");
            }
            if (
strlen(reason) > 0)
            {
                
formatex(msg[len], charsmax(msg) - len" (%L: %s)"i"REASON"reason);
            }
            
show_activity_id(iidnamemsg);
        }
    }
    
    
console_print(id"[AMXX] %L"id"CLIENT_BANNED"name2)
    
    return 
PLUGIN_HANDLED

Ahora habra renstricciones de tipo de admin en los bans, si quieren hacerlo en los kick, slays, slaps, etc. Es igual

Eso fue todo, Gracias
__________________
Allied Modders En Español

Last edited by MexPower; 08-15-2013 at 12:02.
MexPower is offline
 



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 18:17.


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