optimizar plugins de menu de arma
#1
buenos dias gente me ayudan a optimizar el plugins que me ayudaron a crear de menu de arma ya que en " /cstrike/addons/amxmodx/logs/" tiene mas errores el plugins de menu de arma que otros se lo agredeceria muchos

Código PHP:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#include <fun>

new const g_gzPluginName[] = "Armas (MRA)";
new const 
g_szPluginVers[] = "v1.0";
new const 
g_szPluginAuth[] = "Hector y ayuda";

enum _:DATA_WP
{
    WP_NAME[32],
    WP_ENT[21],
    WP_ID,
    WP_MODEL_V[96],
    WP_MODEL_P[96],
    WP_FRAGS
};

new const 
g_szWeapons[][DATA_WP] =
{
    "Ak47 - PRIDE""weapon_ak47"CSW_AK47"models/marihuana/v_ak47-37.mdl""models/marihuana/p_ak47-37.mdl"},
    "Ak47 - DRAGONS""weapon_ak47"CSW_AK47"models/marihuana/v_ak47-36.mdl""models/marihuana/p_ak47-36.mdl"},
    "Ak47 - BLOODSPORT""weapon_ak47"CSW_AK47"models/marihuana/v_ak47-35.mdl""models/marihuana/p_ak47-35.mdl"},
    "M4a1 - MUSICA""weapon_m4a1"CSW_M4A1"models/marihuana/v_m4a1-50.mdl""models/marihuana/p_m4a1-50.mdl"},
    "M4a1 - POSEIDON""weapon_m4a1"CSW_M4A1"models/marihuana/v_m4a1-53.mdl""models/marihuana/p_m4a1-53.mdl"},
    "M4a1 - HOWL""weapon_m4a1"CSW_M4A1"models/marihuana/v_m4a1-52.mdl""models/marihuana/p_m4a1-52.mdl"},
    "AWP - JACKAL""weapon_awp"CSW_AWP"models/marihuana/v_awp-75.mdl""models/marihuana/p_awp-75.mdl"},
    "AWP - DRAGON LORE""weapon_awp"CSW_AWP"models/marihuana/v_awp-76.mdl""models/marihuana/p_awp-76.mdl"},
    "AWP - HYPER BEST""weapon_awp"CSW_AWP"models/marihuana/v_awp-77.mdl""models/marihuana/p_awp-77.mdl"}
};

new 
g_iArmaSelect[33];
new 
g_iFrags[33]

public 
plugin_init()
{
    register_plugin(g_gzPluginNameg_szPluginVersg_szPluginAuth);
    
    
static i;
    for (0sizeof(g_szWeapons); i++)
        RegisterHam(Ham_Item_Deployg_szWeapons[i][WP_ENT], "Ham_Weapons_Deploy_Post"true);
    
    RegisterHam
(Ham_TakeDamage"player""Ham_PlayerTakeDamage");
    
    RegisterHam
(Ham_Killed"player""ham_PlayerKilled"true);
    //RegisterHam(Ham_Spawn, "weaponbox", "ham_SpawnWeaponbox", true);
    register_forward(FM_SetModel"fw_SetModel"1)

    register_menu"Normal Menu"1023"handled_normal_menu" );

    register_clcmd("radio1""Clcmd_AbrirMenu");
}

public 
plugin_precache( ) {
    for( new 0sizeof g_szWeaponsi++ ){

        if (equal(g_szWeapons[i][WP_MODEL_V], "default") || equal(g_szWeapons[i][WP_MODEL_P], "default"))
            return;

        precache_modelg_szWeapons][ WP_MODEL_V ] )
        precache_modelg_szWeapons][ WP_MODEL_P ] )
    }
}

public 
client_putinserver(id)
{
    g_iFrags[id] = 0;
    g_iArmaSelect[id] = -1;
}
public 
Ham_PlayerTakeDamage(iVictimiWeaponiAttackerFloat:damageiDamage_Bits)
{
 if (
iVictim == iAttacker || !is_user_alive(iAttacker) || !is_user_connected(iAttacker) || g_iArmaSelect[iAttacker] <= -
 return 
HAM_IGNORED;
 
 
 new 
Float:newdamage
 newdamage 
damage random_float(10.025.0)
 
SetHamParamFloat(4get_user_weapon(iAttacker) == CSW_AWP damage 2.0 newdamage)
 
 return 
HAM_HANDLED;
}
public 
Ham_Weapons_Deploy_Post(WeaponEntity)
{
    static wOwner;
    wOwner get_pdata_cbase(WeaponEntity414);
    /** Offset 41 pertenece al Owner del arma **/
    
    
if(!pev_valid(wOwner) || !is_user_alive(wOwner))
        return;
    
    
static iWeaponID;
    iWeaponID cs_get_weapon_id(WeaponEntity);
    
    
if (g_iArmaSelect[wOwner] == -1)
        return;

    if (iWeaponID == g_szWeapons[g_iArmaSelect[wOwner]][WP_ID])
    
        if (!equal(g_szWeapons[g_iArmaSelect[wOwner]][WP_MODEL_V] , "default"))
            entity_set_string(wOwnerEV_SZ_viewmodelg_szWeapons[g_iArmaSelect[wOwner]][WP_MODEL_V]);
        
        
if (!equal(g_szWeapons[g_iArmaSelect[wOwner]][WP_MODEL_P] , "default")) 
            entity_set_string(wOwnerEV_SZ_weaponmodelg_szWeapons[g_iArmaSelect[wOwner]][WP_MODEL_P]);
    }
}

public 
ham_PlayerKilled(victiminflictorattackershouldgibs)
{
    if(!(attacker <= get_maxplayers()) || !is_user_connected(attacker) || attacker == victim)
        return HAM_IGNORED;

    g_iFrags[attacker]++;

    return HAM_IGNORED;
}

public 
fw_SetModel(entitymodel[])
{
 if( !
pev_valid(entity) )
 return 
FMRES_IGNORED
 
 
static Classname[64]; pev(entitypev_classnameClassnamesizeof(Classname))
 
 if( !
equal(Classname"weaponbox") )
 return 
FMRES_IGNORED
 
 
static idid pev(entitypev_owner)
 
 
//if(is_user_connected(id))
 // return FMRES_IGNORED
 
if(is_user_admin(id))
 {
 if(
contain(model"_awp") != -1)
 
engfunc(EngFunc_RemoveEntityentity)
 
 if(
contain(model"_ak47") != -1)
 
engfunc(EngFunc_RemoveEntityentity)
 
 if(
contain(model"_m4a1") != -1)
 
engfunc(EngFunc_RemoveEntityentity)
 }
 else
 return 
FMRES_IGNORED
 
 
return FMRES_IGNORED
}
/*
public ham_SpawnWeaponbox(entity)
{
    new owner = entity_get_edict(entity, EV_ENT_owner);

    if (g_iArmaSelect[owner] == -1)
        return HAM_IGNORED;

    if (get_user_weapon(owner) == g_szWeapons[g_iArmaSelect[owner]][WP_ID])
    {
        g_iArmaSelect[owner] = -1;
        set_pev(entity, pev_flags, FL_KILLME);
        dllfunc(DLLFunc_Think, entity);
        return HAM_IGNORED;
    }

    return HAM_IGNORED;
}
*/
public Clcmd_AbrirMenu(id)
{
    if (~get_user_flags(id) & ADMIN_RESERVATION)
    {
        show_normal_menu(id);
        return PLUGIN_HANDLED;
    }

    static iMenuszText[64];
    iMenu menu_create("Menu de Armas \r[MRA\r]""HandlerMenu_Armas");
    
    
static i;
    for (0sizeof(g_szWeapons); i++)
    {
        /** Adaptalo **/
        if (g_iFrags[id] >= g_szWeapons[i][WP_FRAGS])  
            formatex
(szTextcharsmax(szText), "\w%s"g_szWeapons[i][WP_NAME]);
        else
            formatex(szTextcharsmax(szText), "\d%s \r(\y%d\d GRATIS\r)"g_szWeapons[i][WP_NAME], g_szWeapons[i][WP_FRAGS]);
        
        menu_additem
(iMenuszText__menu_makecallback("CallBackMenu_Armas"));
    }
    menu_additem(iMenu"Salir")
    
    menu_setprop
(iMenuMPROP_PERPAGE0);
    menu_display(idiMenu);
    return PLUGIN_HANDLED;
}

public 
CallBackMenu_Armas(idiMenuiItem)
{
    if (g_iFrags[id] >= g_szWeapons[iItem][WP_FRAGS])
        return ITEM_ENABLED;
    
    
return ITEM_DISABLED;
}

public 
HandlerMenu_Armas(idiMenuiItem)
{
    if (iItem == MENU_EXIT)
        return PLUGIN_HANDLED;
    
    
//Strip_User_Primaries(id, iItem);
    drop_weapons(id1)
    g_iArmaSelect[id] = iItem;
    give_item(idg_szWeapons[iItem][WP_ENT]);
    cs_set_user_bpammo(idg_szWeapons[iItem][WP_ID], 90)
    chat_color(id"!g[MRA] !yConseguiste una !g%s!"g_szWeapons[iItem][WP_NAME], g_szWeapons[iItem][WP_FRAGS], g_szWeapons[iItem][WP_FRAGS] > "s" "");
    
    
return PLUGIN_HANDLED
}

show_normal_menu(id)
{
    static szbuffer1024 ], lenkeys;

    len 0;
    
    len 
+= formatex(szbuffer[len], charsmax(szbuffer) - len"\yMenú de venta^n^n");

    len += formatex(szbuffer[len], charsmax(szbuffer) - len"\wMenu de \yARMA." );
    len += formatex(szbuffer[len], charsmax(szbuffer) - len"\wContacto:\y Hector Guillem" );
    len += formatex(szbuffer[len], charsmax(szbuffer) - len"\r0. \wCerrar" );
    
    keys 
= (1<<9);

    show_menu(idkeysszbuffer, -1"Normal Menu" );

    return PLUGIN_HANDLED;
}

public 
handled_normal_menu(idkey)
{
    if (key != 9)
        client_cmd(id"spk ^"Ui/buttonclickrelease.wav^"");

    return PLUGIN_HANDLED;
}
/*
Strip_User_Primaries(id, item)
{
    new iWeapon, iNext, iActiveItem
    new 
    iWeapon = get_pdata_cbase(id, item)
    iActiveItem = get_pdata_cbase(id, m_pActiveItem)
    while( pev_valid(iWeapon) )
    {
        iNext = get_pdata_cbase(iWeapon, m_pNext, 4)
        if( iActiveItem == iWeapon )
        {
            ExecuteHam(Ham_Item_Holster, iWeapon)
        }
        set_pev(iWeapon, pev_flags, pev(iWeapon, pev_flags) | FL_KILLME)
        iWeapon = iNext
    }
} */


// Weapon bitsums
const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<
CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<
CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)

// Drop primary/secondary weapons
stock drop_weapons(iddropwhat)
{
 
 
// Get user weapons
 
static weapons[32], numiweaponid
 num 
// reset passed weapons count (bugfix)
 
get_user_weapons(idweaponsnum)
 
 
// Loop through them and drop primaries or secondaries
 
for (0numi++)
 {
 
// Prevent re-indexing the array
 
weaponid weapons[i]
 
 if ((
dropwhat == && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) /*|| (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM))*/ )
 {
 
// Get weapon entity
 
static wname[32]
 
 
get_weaponname(weaponidwnamecharsmax(wname))
 
 
engclient_cmd(id"drop"wname)
 
cs_set_user_bpammo(idweaponid0)
 }
 }
}

chat_color(id, const input[], any:...)
{
    static message[191];
    vformat(message190input3);

    replace_all(message190"!g""^4");
    replace_all(message190"!t""^3");
    replace_all(message190"!y""^1");

    message_begin((id) ? MSG_ONE_UNRELIABLE MSG_BROADCASTget_user_msgid("SayText"), .player id);
    write_byte((id) ? id 33);
    write_string(message);
    message_end();

[Imagen: b_560_95_1.png]
Responder
#2
que logs te tira?
Pawn Básico no critiquen xD  Approved

Responder
#3
Eso te pasa por cambiar el autor rata.

https://amxmodx-es.com/Thread-porque-no-...#pid209887
Responder
#4
(04/11/2020, 12:31 PM)Chema escribió: Eso te pasa por cambiar el autor rata.

https://amxmodx-es.com/Thread-porque-no-...#pid209887

xd y acaso yo se lo cambie hay dice hector y ayuda y yo lo mande con otro amigo a ponerle mas damage el puso eso

(04/11/2020, 11:53 AM)Meliodas escribió: que logs te tira?

verga yo borre todo los log pero antes me dijieron que hay que cambiarles unos code para otimizarlo y balla fluido
[Imagen: b_560_95_1.png]
Responder
#5
Y pensar que este tipo hector guillen se pasa peliandose con ratas como deiviz edition por ver quién vende los mejores plugins, cuando se los descargan de Google jajaja.
[Imagen: zcsztw-4.png] [Imagen: 6u5fj2-4.png]
[Imagen: linkedin_thumb_image.png][Imagen: 76561198283253977.png][Imagen: linkedin_thumb_image.png]
Responder
#6
¿Un amigo? En tu misma foto de avatar aparece el nombre del sujeto "autor" del plugin, vete a robar autor a otro lado, esta clarísimo que, o eres tu o eres muy cercano a el.
Responder
#7
(12/11/2020, 02:51 AM)DeivizEditionVE escribió: Que puto JAJAJAJJAJAJA TANTA MIERDA QUE DICE POR HAY QUE EL ISO EL PLUGINS XD TE DIERA EL QUE ISE A REAPI PERO NO MERECES NAH XD

que vas a hacer vos, seguro agarraste alguno de acá y te pusiste como autor, si sos igual de rata que el

Responder
#8
Vuelvo después de 3 meses y este niño todavía roba autor xd.
Corazón I dream of someday being able to have your near. Corazón
[Imagen: 76561199006140497.png]
Responder
#9
[Imagen: a6b6c52263351ed0e5553ab1fad51e6c.gif]
"Cada golpe es una lección, y cada lección te hace mejor."

[Imagen: b_350_20_000000_8a7300_ffffff_eeff00.png]
[Imagen: 76561198371193937.png]
Responder
#10
y le banearon su tercera cuenta a deiviz edition xdd
[Imagen: zcsztw-4.png] [Imagen: 6u5fj2-4.png]
[Imagen: linkedin_thumb_image.png][Imagen: 76561198283253977.png][Imagen: linkedin_thumb_image.png]
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)