Hats
#1
Buenas les dejo un plugin que NO es de mi auditoria ( es de Mario AR )
es un menú de hats que se guardan por setinfo si no mal recuerdo xd
pueden editarlo y toda esa madre de levels xd

Código PHP:
#include <amxmodx>
#include <engine>

#define PLUGIN "MM Hats"
#define VERSION "0.1"

new g_accesorio[33];
new 
g_cb_item_disabled;

new const 
info_nm[] = "_cgmm";

new const 
ent_cm[] = "hat_ent";

enum STRUCT_ACCESORIOS
{
    
nombre[64],
    
model[64],
    
acceso
};

// Acceso -1 = no requiere
new const ACCESORIOS[][STRUCT_ACCESORIOS] =
{
    { 
"skyrim",       "models/ttt_hats/ttt_skyrim.mdl",        -},
    { 
"subzero",    "models/ttt_hats/ttt_subzero.mdl",        -},
    { 
"superspace",    "models/ttt_hats/ttt_superspace.mdl",        -},
    { 
"anonymous",    "models/ttt_hats/ttt_anonymous.mdl",        ADMIN_BAN },
    { 
"beanie",       "models/ttt_hats/ttt_beanie.mdl",        ADMIN_BAN },
    { 
"harrypotter",           "models/ttt_hats/ttt_harrypotter.mdl",        -},
    { 
"headcrab",  "models/ttt_hats/ttt_headcrab.mdl",        -},
    { 
"maligno",    "models/ttt_hats/ttt_maligno.mdl",        -},
    { 
"mexicano",      "models/ttt_hats/ttt_mexicano.mdl",       ADMIN_BAN },
    { 
"samurai",       "models/ttt_hats/ttt_samurai.mdl",       -},//
    
"afro",         "models/ttt_hats/afro.mdl",       ADMIN_BAN },
    { 
"angel2",     "models/ttt_hats/angel2.mdl",       ADMIN_BAN },
    { 
"arrow",     "models/ttt_hats/arrow.mdl",       ADMIN_BAN },
    { 
"barril",         "models/ttt_hats/barril.mdl",       -},
    { 
"beerhat",       "models/ttt_hats/beerhat.mdl",       ADMIN_BAN },
    { 
"bighead",        "models/ttt_hats/bighead.mdl",       -},
    { 
"cheesehead""models/ttt_hats/cheesehead.mdl",       -}
};

public 
plugin_precache()
{
    
// Accesorios
    
for (new 0sizeof(ACCESORIOS); i++)
        
precache_model(ACCESORIOS[i][model]);
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSION"Mario AR.");
    
register_clcmd("say /hats""show_menu_hats");
    
register_clcmd("say /accesorios""show_menu_hats");
    
// Start hats
    
new ent;
    for (new 
1<= 32i++)
    {
        
ent create_entity("info_target");
        
entity_set_int(entEV_INT_movetypeMOVETYPE_FOLLOW);
        
entity_set_edict(entEV_ENT_owneri);
        
entity_set_string(entEV_SZ_classnameent_cm);
    }
    
    
g_cb_item_disabled menu_makecallback("cb_disabled");
}


public 
client_putinserver(id)
{
    
set_task(4.0"auto_set"id);
}

public 
auto_set(id)
{
    if (!
is_user_connected(id) || g_accesorio[id])
    {
        return;
    }
    
    new 
info[33];
    
get_user_info(idinfo_nminfocharsmax(info));
    
    new 
numsznum[2];
    for (
num 0num 2num++)
    {
        
sznum[num] = info[num];
    }
    
    
num str_to_num(sznum);
    
    if (
num)
    {
        if (
get_user_flags(id) & ACCESORIOS[num-1][acceso])
        {
            
g_accesorio[id] = num;
            new 
ent find_ent_by_owner(-1ent_cmid);
            
entity_set_model(entACCESORIOS[num-1][model]);
            
entity_set_edict(entEV_ENT_aimentid);
            
entity_set_int(entEV_INT_movetypeMOVETYPE_FOLLOW);
            
            
zp_colored_print(id"^x04[ZP]^x01 Tu accesorio ha sido cargado (%c%s%c)."'^3'ACCESORIOS[num-1][nombre], '^1');
        }
        else
        {
            for (
num 0num 2num++)
            {
                
info[num] = 0;
            }
            
            
set_user_info(idinfo_nminfo);
            
client_cmd(id"setinfo ^"%s^" ^"%s^""info_nminfo);
        }
    }
}

public 
client_disconnect(id)
{
    if (
g_accesorio[id])
    {
        new 
ent find_ent_by_owner(-1ent_cmid);
        
entity_set_model(ent"");
        
entity_set_edict(entEV_ENT_aiment0);
        
entity_set_int(entEV_INT_movetypeMOVETYPE_NONE);
        
entity_set_origin(entFloat:{8192.0,8192.0,8192.0});
        
        
g_accesorio[id] = 0;
    }
}

public 
show_menu_hats(id)
{
    new 
menutitle[90], flags;
    new 
menu menu_create("\r[ZP] \yAccesorios""menu_hats");
    
    
flags get_user_flags(id);
    
    
formatex(menutitlecharsmax(menutitle), "%sRemover%s accesorio"g_accesorio[id] ? "\r" "\d"g_accesorio[id] ? "\w" "\d");
    
menu_additem(menumenutitle, .callback g_accesorio[id] ? -g_cb_item_disabled);
    
    for (new 
0sizeof(ACCESORIOS); i++)
    {
        if (
flags ACCESORIOS[i][acceso])
        {
            
formatex(menutitlecharsmax(menutitle), "\w%s%s"ACCESORIOS[i][nombre], g_accesorio[id] == i+"\y [Seleccionado]" "");
            
menu_additem(menumenutitle);
        }
        else
        {
            
formatex(menutitlecharsmax(menutitle), "\y[Solo ADMIN]\d %s"ACCESORIOS[i][nombre]);
            
menu_additem(menumenutitle, .callback g_cb_item_disabled);
        }
    }
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_setprop(menuMPROP_BACKNAME"Anterior");
    
menu_setprop(menuMPROP_NEXTNAME"Siguiente");
    
menu_setprop(menuMPROP_EXITNAME"\ySalir");
    
menu_setprop(menuMPROP_NUMBER_COLOR"\r");
    
    
menu_display(idmenu0);
    
    return 
PLUGIN_CONTINUE;
}

public 
cb_disabled(idmenukey)
{
    return 
ITEM_DISABLED;
}

public 
menu_hats(idmenukey)
{
    if(!
is_user_connected(id) || !(<= key <= sizeof(ACCESORIOS)))
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    if(
key == 0)
    {
        if (!
g_accesorio[id]) zp_colored_print(id"^x04[ZP]^x01 No llevas un accesorio.");
        else
        {
            new 
ent find_ent_by_owner(-1ent_cmid);
            
entity_set_model(ent"");
            
entity_set_edict(entEV_ENT_aiment0);
            
entity_set_int(entEV_INT_movetypeMOVETYPE_NONE);
            
entity_set_origin(entFloat:{8192.0,8192.0,8192.0});
            
            
g_accesorio[id] = 0;
            
zp_colored_print(id"^x04[ZP]^x01 Ahora no llevas un accesorio.");
            
            new 
info[33];
            
get_user_info(idinfo_nminfocharsmax(info));
            
            for (new 
02i++)
            {
                
info[i] = 0;
            }
            
            
set_user_info(idinfo_nminfo);
            
client_cmd(id"setinfo ^"%s^" ^"%s^""info_nminfo);
        }
    }
    else
    {
        
g_accesorio[id] = key;
        new 
ent find_ent_by_owner(-1ent_cmid);
        
entity_set_model(entACCESORIOS[key-1][model]);
        
entity_set_edict(entEV_ENT_aimentid);
        
entity_set_int(entEV_INT_movetypeMOVETYPE_FOLLOW);
        
        new 
info[33];
        
get_user_info(idinfo_nminfocharsmax(info));
        
        new 
sznum[3];
        
num_to_str(keysznum2);
        for (new 
02i++)
        {
            
info[i] = sznum[i];
        }
        
        
set_user_info(idinfo_nminfo);
        
client_cmd(id"setinfo ^"%s^" ^"%s^""info_nminfo);
        
        
zp_colored_print(id"^x04[ZP]^x01 Ahora llevas un accesorio (%c%s%c)."'^3'ACCESORIOS[key-1][nombre], '^1');
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}
stock zp_colored_print(id, const msg[], any:...)
{
    static 
message[191];
    
vformat(message190msg3);
    static 
msgSayText;
    if (!
msgSayText)
        
msgSayText get_user_msgid("SayText");
    
    
message_begin(id MSG_ONE MSG_BROADCASTmsgSayText_id);
    
write_byte(33);
    
write_string(message);
    
message_end();



PD; elijan otro guardado para dicho plugin solo es un ejemplo para que no busquen tutoriales de como crear hats
[Imagen: zcsztw-4.png] [Imagen: 6u5fj2-4.png]
[Imagen: linkedin_thumb_image.png][Imagen: 76561198283253977.png][Imagen: linkedin_thumb_image.png]
Responder
#2
setinfo, lol. No publiquen estas cosas.
Plugins:
En GitHub
Responder
#3
(03/02/2019, 02:34 PM)w0w escribió: setinfo, lol. No publiquen estas cosas.

Como dije NO es mío, solo es un ejemplo para que tomen la porción de código, pero si quieres te lo guardo en sql/vault Whatever


PD; si no te gusta no lo veas y ya Genius
[Imagen: zcsztw-4.png] [Imagen: 6u5fj2-4.png]
[Imagen: linkedin_thumb_image.png][Imagen: 76561198283253977.png][Imagen: linkedin_thumb_image.png]
Responder
#4
No es que no me guste sino básicamente es de lo peor que puede haber. Guardarlo en setinfo cuando con la mayoría de cosas que hay puede ni guardarse.
Plugins:
En GitHub
Responder
#5
(03/02/2019, 02:38 PM)w0w escribió: No es que no me guste sino básicamente es de lo peor que puede haber. Guardarlo en setinfo cuando con la mayoría de cosas que hay puede ni guardarse.

ahí le agregue un comentario especificando que es un ejemplo. Whatever
[Imagen: zcsztw-4.png] [Imagen: 6u5fj2-4.png]
[Imagen: linkedin_thumb_image.png][Imagen: 76561198283253977.png][Imagen: linkedin_thumb_image.png]
Responder
#6
Podrías poner los modelos por favor
Responder
#7
Código PHP:
public client_disconnect(id)
{
    if (
g_accesorio[id])
    {
        new 
ent find_ent_by_owner(-1ent_cmid);
        
entity_set_model(ent"");
        
entity_set_edict(entEV_ENT_aiment0);
        
entity_set_int(entEV_INT_movetypeMOVETYPE_NONE);
        
entity_set_origin(entFloat:{8192.0,8192.0,8192.0});
        
        
g_accesorio[id] = 0;
    }


esta demas puesto que cuando el jugador se desconecta se va al origen 0 solo, osea al centro del mundo lo que podrias seria ocultar el model con
Código PHP:
entity_set_model(ent""); 
o con
Código PHP:
EF_NODRAW 
para que no se lo consigan por ahi
Competitive/Face it Pick Up Game (PUG) servidor de prueba: 45.77.94.109:27016 Click para Entrar
[Imagen: b_350_20_5A6C3E_383F2D_D2E1B5_2E3226.png]

(14/08/2015, 10:15 PM)Sugisaki escribió: "El mundo es caotico, irracional e injusto. No tiene ningun significado"
Palabras que desde hace mucho tiempo he buscado para describir, ¿Que es el mundo?
Crab

Código PHP:
if(ayuda && free)
{
    exit();

Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)