solucionado
#1
solucionado muchas gracias
Responder
#2
Código PHP:
#include <amxmodx>
#include <hamsandwich>
#include <engine>

// [ PLUGIN ]
#define PLUGIN "HATS"
#define VERSION "1.0"
#define CREADOR "Emanuelitop15"
#define TAG "^4[gorritos ekisde]^1"

// [ VARIABLES ]
new len[512], poss[3];
new 
g_frags[MAX_PLAYERS+1];
new 
g_ent_hat[MAX_PLAYERS+1], g_hat_puesto[MAX_PLAYERS+1];

enum _gorritos hat_nombre[21], hat_mdl[101], hat_frags };
new const 
iHats[][gorritos] =
{
    { 
"Quitar hat"""},
    { 
"Navidad""models/Hats/navidad.mdl"1, },
    { 
"River""models/Hats/river.mdl"20, },
    { 
"Bomba""models/Hats/bomba.mdl"30, },
    { 
"Leyenda""models/Hats/leyenda.mdl"45 },
    { 
"Vikingo""models/Hats/vikingo.mdl"55  },
    { 
"Porrero""models/Hats/marimari.mdl"60 },
    { 
"Nemesis""models/Hats/nemesis.mdl"70 },
    { 
"Diablo""models/Hats/diablo.mdl"80 },
    { 
"DJ""models/Hats/dj.mdl"90 },
    { 
"Dragon""models/Hats/dragon.mdl"100 },
    { 
"Gorra Staff""models/Hats/staff.mdl"120 },
    { 
"Calabarda""models/Hats/S5/calabarda.mdl" 150 },
    { 
"Halo""models/Hats/S5/halomaster.mdl" 170 },
    { 
"Ekisde""models/Hats/S5/xD.mdl" 200 }
};

// [ PLUGIN INIT / PRECACHE ] 
public plugin_init()
{
    
register_plugin(PLUGINVERSIONCREADOR);
    
RegisterHam(Ham_Spawn"player""ham_aparicion_del_jugador"1);
    
RegisterHam(Ham_Killed"player""ham_jasesinado_pre"0);
    
register_clcmd("say /hats""show_menu_hats");
}

public 
plugin_precache()
{
    new 
i;

    for (
0sizeof (iHats); i++)
    {
        if (!(
equal(iHats[i][hat_mdl], "")))
            
precache_model(iHats[i][hat_mdl]);
    }
}

// [ SPAWN DEL JUGADOR ]
public ham_aparicion_del_jugador(id)
{
    if (!
is_user_alive(id))
        return;
    
    
colocar_hat(id);
}

// [ MUERTE DEL JUGADOR ]
public ham_jasesinado_pre(victimaid)
{
    if (!
is_user_connected(id)) return HAM_IGNORED;

    if (
victima != idg_frags[id]++;

    return 
HAM_HANDLED;
}

// [ USUARIO DESCONECTADO ]
public client_disconnected(id)
    
remover_hat(id);

// [ FUNCIONES ]
public show_menu_hats(id)
{
    new 
menu;
    
menu menu_create("\yMenu de Hats\d\R""hats_menu");

    for(new 
sizeof (iHats); i++)
    {
        if (
== 0formatex(lencharsmax(len), "\d%s"iHats[i][hat_nombre]);
        else if (
g_hat_puesto[id] == iformatex(lencharsmax(len) , "\d%s \r(Equipado)"iHats[i][hat_nombre]);
        else 
formatex(lencharsmax(len), iHats[i][hat_nombre]);
        
        
num_to_str(iposscharsmax(poss));
        
menu_additem(menu lenposs);
    }

    
menu_setprop(menu MPROP_BACKNAME"Volver");
    
menu_setprop(menu MPROP_NEXTNAME"Siguiente");
    
menu_setprop(menu MPROP_EXITNAME"Salir");
    
menu_display(idmenu);
}
public 
hats_menu(idmenukey)
{    
    if (
key == MENU_EXIT || !is_user_connected(id))
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    new 
szkey[6], accesscallbackitem;
    
menu_item_getinfo(menukeyaccessszkeycharsmax(szkey), __callback);
    
item str_to_num(szkey);

    
menu_destroy(menu);

    if (
item == 0)
    {
        
g_hat_puesto[id] = 0;
        
remover_hat(id);
        return 
PLUGIN_HANDLED;
    }

    if (
g_frags[id] < iHats[item][hat_frags])
    {
        
client_print_color(id,  print_team_default"%s No tienes los^3 FRAGS^1 necesarios."TAG);
        return 
PLUGIN_HANDLED;
    }

    
g_hat_puesto[id] = item;
    
colocar_hat(id);
    
client_print_color(id,  print_team_default,"%s Te colocaste el hat:^4 %s^1"TAGiHats[item][hat_nombre]);
    
    
    return 
PLUGIN_HANDLED;
}

// [ CHEQUEAMOS ANTES DE DARLE O QUITARLE UN HAT ]
colocar_hat(id)
{    
    if (
g_hat_puesto[id] < || g_hat_puesto[id] >= sizeof (iHats)
    || 
g_frags[id] < iHatsg_hat_puesto[id] ][hat_frags])
        
g_hat_puesto[id] = 0;

    
remover_hat(id);
                        
    
g_ent_hat[id] = create_entity("info_target");
                
    if (!
is_valid_ent(g_ent_hat[id]) || !g_hat_puesto[id])
        return;
                                
    
entity_set_int(g_ent_hat[id], EV_INT_movetypeMOVETYPE_FOLLOW);
    
entity_set_edict(g_ent_hat[id], EV_ENT_aimentid);
    
entity_set_int(g_ent_hat[id], EV_INT_rendermodekRenderNormal);
    
entity_set_model(g_ent_hat[id], iHatsg_hat_puesto[id] ][hat_mdl]);
}

remover_hat(id)
{
    if (
is_valid_ent(g_ent_hat[id]))
    {
        
remove_entity(g_ent_hat[id]);
        
g_ent_hat[id] = 0;
    }

___________________________________
SI NECESITAS UN PLUGIN TE LO HAGO $$$
COMUNICATE A MI DISCORD: emanuelitop15
Responder
#3
gracias
Responder
#4
esta parte

Código PHP:
|| g_hat_puesto[id] < iHatsg_hat_puesto[id] ][hat_frags

me equivoque cambiala por

Código PHP:
|| g_frags[id] < iHatsg_hat_puesto[id] ][hat_frags
___________________________________
SI NECESITAS UN PLUGIN TE LO HAGO $$$
COMUNICATE A MI DISCORD: emanuelitop15
Responder
#5
gracias
Responder
#6
podes crear un guardado de datos para que guarde los datos que necesitas.

Aca algunos tutos de sqlite.

https://amxmodx-es.com/Thread-Tutorial-sobre-sqlite
https://amxmodx-es.com/Thread-Gu%C3%ADa-...tas-SQLite
https://forums.alliedmods.net/showthread.php?t=129690

O sino vi que nrds tiene un plugin para guardar/cargar datos con sqlite, yo lo probé y te servirá ya que es sencillo y facil de entender.
https://amxmodx-es.com/Thread-TUT-Sistem...ado-Simple

Despues tmb tienes otros guardados que yo no recomiendo pero hay tutoriales por aca en el foro: fvault, nvault, adv vault.
___________________________________
SI NECESITAS UN PLUGIN TE LO HAGO $$$
COMUNICATE A MI DISCORD: emanuelitop15
Responder
#7
gracias
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)