sacar native a este extra item
#1
como le puedo sacar native a este extra items para agregarlo a un menu de tienda si me dejan los pasos para a si yo sacarles a las demas
Código PHP:
//#include <zombie_escape>

new const g_item_name[] = {"Unlimited Clip \r(One Round)"}
const 
g_item_cost 10

// CS Offsets
#if cellbits == 32
const OFFSET_CLIPAMMO 51
#else
const OFFSET_CLIPAMMO 65
#endif
const OFFSET_LINUX_WEAPONS 4

// Max Clip for weapons
new const MAXCLIP[] = { -113, -11017, -1303013020253035251220,
            
10301008303020273030, -150 }

new 
g_itemid_infammog_has_unlimited_clip[33]

public 
plugin_init()
{
    
register_plugin("[ZE] Extra: Unlimited Clip""1.0""MeRcyLeZZ")
    
    
g_itemid_infammo ze_register_item(g_item_nameg_item_cost0)

    
register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
}

public 
ze_select_item_pre(iditemid)
{
    
// Return Available and we will block it in Post, So it dosen't affect other plugins
    
if (itemid != g_itemid_infammo)
        return 
ZE_ITEM_AVAILABLE
   
    
// Available for Humans only, So don't show it for zombies
    
if (ze_is_user_zombie(id))
        return 
ZE_ITEM_DONT_SHOW
   
    
return ZE_ITEM_AVAILABLE
}

// Player buys our upgrade, set the unlimited ammo flag
public ze_select_item_post(playeritemid)
{
    if (
itemid != g_itemid_infammo)
        return
    
    
g_has_unlimited_clip[player] = true
}

// Reset flags for all players on newround
public ze_user_humanized(id)
{
    
g_has_unlimited_clip[id] = false;
}

// Unlimited clip code
public message_cur_weapon(msg_idmsg_destmsg_entity)
{
    
// Player doesn't have the unlimited clip upgrade
    
if (!g_has_unlimited_clip[msg_entity])
        return;
    
    
// Player not alive or not an active weapon
    
if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
        return;
    
    static 
weaponclip
    weapon 
get_msg_arg_int(2// get weapon ID
    
clip get_msg_arg_int(3// get weapon clip
    
    // Unlimited Clip Ammo
    
if (MAXCLIP[weapon] > 2// skip grenades
    
{
        
set_msg_arg_int(3get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
        
        
if (clip 2// refill when clip is nearly empty
        
{
            
// Get the weapon entity
            
static wname[32], weapon_ent
            get_weaponname
(weaponwnamesizeof wname 1)
            
weapon_ent fm_find_ent_by_owner(-1wnamemsg_entity)
            
            
// Set max clip on weapon
            
fm_set_weapon_ammo(weapon_entMAXCLIP[weapon])
        }
    }
}

// Find entity by its owner (from fakemeta_util)
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
    while ((
entity engfunc(EngFunc_FindEntityByStringentity"classname"classname)) && pev(entitypev_owner) != owner) {}
    
    return 
entity;
}

// Set Weapon Clip Ammo
stock fm_set_weapon_ammo(entityamount)
{
    
set_pdata_int(entityOFFSET_CLIPAMMOamountOFFSET_LINUX_WEAPONS);

Responder
#2
Código PHP:
public plugin_native()
{
register_native("Unlimited_Clip""message_cur_weapon"1)


Agrega esto a cualquier parte de tu plugin, esa funcion, message_cur_weapon es la funcion que da las balas infinitas
Si no te gusta algo, cámbialo. Si no lo puedes cambiar, cambia la forma en que piensas sobre ello <3
Responder
#3
(22/08/2018, 12:21 PM)Saber escribió:
Código PHP:
public plugin_native()
{
register_native("Unlimited_Clip""message_cur_weapon"1)


Agrega esto a cualquier parte de tu plugin, esa funcion, message_cur_weapon es la funcion que da las balas infinitas

gracias, pero como dije tengo otros extra items pero no le puedo sacar la native me puedes explicar como se la sacastes a umlimited_clip

(22/08/2018, 12:21 PM)Saber escribió:
Código PHP:
public plugin_native()
{
register_native("Unlimited_Clip""message_cur_weapon"1)


Agrega esto a cualquier parte de tu plugin, esa funcion, message_cur_weapon es la funcion que da las balas infinitas

salen estos logs al copilar
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright © 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Undefined symbol "register_native" on line 22
Error: Undefined symbol "register_plugin" on line 27
Error: Undefined symbol "ze_register_item" on line 29
Error: Undefined symbol "register_message" on line 31
Error: Undefined symbol "ZE_ITEM_AVAILABLE" on line 38
Error: Undefined symbol "ze_is_user_zombie" on line 41
Error: Undefined symbol "ZE_ITEM_DONT_SHOW" on line 42
Error: Undefined symbol "ZE_ITEM_AVAILABLE" on line 44
Warning: Loose indentation on line 53
Error: Undefined symbol "is_user_alive" on line 70
Error: Undefined symbol "get_msg_arg_int" on line 74
Error: Undefined symbol "get_msg_arg_int" on line 75
Error: Undefined symbol "set_msg_arg_int" on line 80
Error: Undefined symbol "get_weaponname" on line 86
Error: Number of arguments does not match definition on line 86
Error: Undefined symbol "engfunc" on line 98
Error: Undefined symbol "set_pdata_int" on line 106
Warning: Symbol is never used: "amount" on line 107
Warning: Symbol is never used: "entity" on line 107

16 Errors.
Could not locate output file C:\Users\Usuario\Desktop\ze_extra_unlimited_clip.amx (compile failed).
Responder
#4
te tira todos esos logs porque solo tienes la libreria de zombie_escape

agrega la libreria amxmodx y amxmisc
Si no te gusta algo, cámbialo. Si no lo puedes cambiar, cambia la forma en que piensas sobre ello <3
Responder
#5
si lo queres para un normal acá te lo dejo en bandeja


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

// CS Offsets
#if cellbits == 32
const OFFSET_CLIPAMMO 51
#else
const OFFSET_CLIPAMMO 65
#endif
const OFFSET_LINUX_WEAPONS 4

// Max Clip for weapons
new const MAXCLIP[] = { -113, -11017, -1303013020253035251220,
            
10301008303020273030, -150 }

new 
g_has_unlimited_clip[33]

public 
plugin_init()
{
    
register_plugin("Extra: Unlimited Clip""1.0""MeRcyLeZZ")
    
register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
}
public 
plugin_natives()
{
    
register_native("UnlimitedClip""BuyUnlimited"1)
}
public 
BuyUnlimited(id)
{
    
g_has_unlimited_clip[id] = true
}
public 
message_cur_weapon(msg_idmsg_destmsg_entity)
{
    
// Player doesn't have the unlimited clip upgrade
    
if (!g_has_unlimited_clip[msg_entity])
        return;
    
    
// Player not alive or not an active weapon
    
if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
        return;
    
    static 
weaponclip
    weapon 
get_msg_arg_int(2// get weapon ID
    
clip get_msg_arg_int(3// get weapon clip
    
    // Unlimited Clip Ammo
    
if (MAXCLIP[weapon] > 2// skip grenades
    
{
        
set_msg_arg_int(3get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
        
        
if (clip 2// refill when clip is nearly empty
        
{
            
// Get the weapon entity
            
static wname[32], weapon_ent
            get_weaponname
(weaponwnamesizeof wname 1)
            
weapon_ent fm_find_ent_by_owner(-1wnamemsg_entity)
            
            
// Set max clip on weapon
            
fm_set_weapon_ammo(weapon_entMAXCLIP[weapon])
        }
    }
}

// Find entity by its owner (from fakemeta_util)
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
    while ((
entity engfunc(EngFunc_FindEntityByStringentity"classname"classname)) && pev(entitypev_owner) != owner) {}
    
    return 
entity;
}

// Set Weapon Clip Ammo
stock fm_set_weapon_ammo(entityamount)
{
    
set_pdata_int(entityOFFSET_CLIPAMMOamountOFFSET_LINUX_WEAPONS);


en tu plugin de menu tan solo agregas

Código PHP:
native UnlimitedClip(id

y en el case ejemplo

Código PHP:
case UnlimitedClip(id

saludos
(07/06/2018, 09:51 PM)Hypnotize escribió:
(07/06/2018, 06:55 PM)Nazy.- escribió: este sitio apesta pacman

lo único que apesta es tu ano, deja de robar autor rata

Responder
#6
(22/08/2018, 01:23 PM)BlasKer escribió: si lo queres para un normal acá te lo dejo en bandeja


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

// CS Offsets
#if cellbits == 32
const OFFSET_CLIPAMMO 51
#else
const OFFSET_CLIPAMMO 65
#endif
const OFFSET_LINUX_WEAPONS 4

// Max Clip for weapons
new const MAXCLIP[] = { -113, -11017, -1303013020253035251220,
            
10301008303020273030, -150 }

new 
g_has_unlimited_clip[33]

public 
plugin_init()
{
    
register_plugin("Extra: Unlimited Clip""1.0""MeRcyLeZZ")
    
register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
}
public 
plugin_natives()
{
    
register_native("UnlimitedClip""BuyUnlimited"1)
}
public 
BuyUnlimited(id)
{
    
g_has_unlimited_clip[id] = true
}
public 
message_cur_weapon(msg_idmsg_destmsg_entity)
{
    
// Player doesn't have the unlimited clip upgrade
    
if (!g_has_unlimited_clip[msg_entity])
        return;
    
    
// Player not alive or not an active weapon
    
if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
        return;
    
    static 
weaponclip
    weapon 
get_msg_arg_int(2// get weapon ID
    
clip get_msg_arg_int(3// get weapon clip
    
    // Unlimited Clip Ammo
    
if (MAXCLIP[weapon] > 2// skip grenades
    
{
        
set_msg_arg_int(3get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
        
        
if (clip 2// refill when clip is nearly empty
        
{
            
// Get the weapon entity
            
static wname[32], weapon_ent
            get_weaponname
(weaponwnamesizeof wname 1)
            
weapon_ent fm_find_ent_by_owner(-1wnamemsg_entity)
            
            
// Set max clip on weapon
            
fm_set_weapon_ammo(weapon_entMAXCLIP[weapon])
        }
    }
}

// Find entity by its owner (from fakemeta_util)
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
    while ((
entity engfunc(EngFunc_FindEntityByStringentity"classname"classname)) && pev(entitypev_owner) != owner) {}
    
    return 
entity;
}

// Set Weapon Clip Ammo
stock fm_set_weapon_ammo(entityamount)
{
    
set_pdata_int(entityOFFSET_CLIPAMMOamountOFFSET_LINUX_WEAPONS);


en tu plugin de menu tan solo agregas

Código PHP:
native UnlimitedClip(id

y en el case ejemplo

Código PHP:
case UnlimitedClip(id

saludos

gracias
Responder
#7
https://amxmodx-es.com/Thread-TUT-Plugin...subplugins

Responder
#8
https://amxmodx-es.com/Thread-ZA-Como-pu...#pid182486
[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)