quitar municion infinita al salir y morir
#1
buenas queria hacer un pedido para ver si me pueden hacer que cuando muera o salga del servidor las balas infinitas se quiten y tenga que volver a comprarlas como tengo un ctf quisiera eso que cuando muera se le quitan las balas infinitas y tengan q volver a comprarlas y cuando se salgan del servidor y vuelvan a entrar se les quite tambien ya que eso ultimo no lo tiene
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);

Responder
#2
plugin_init

Código PHP:
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1

Código PHP:
public fw_PlayerSpawn_Post(id)
    
g_has_unlimited_clip[id] = false 
Responder
#3
(22/08/2018, 08:29 PM)Nelo escribió: plugin_init

Código PHP:
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1

Código PHP:
public fw_PlayerSpawn_Post(id)
    
g_has_unlimited_clip[id] = false 

sale este error 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 "RegisterHam" on line 23
Warning: Expression has no effect on line 23
Warning: Expression has no effect on line 23
Warning: Expression has no effect on line 23
Error: Expected token: ";", but found ")" on line 23
Error: Invalid expression, assumed zero on line 23
Error: Too many error messages on one line on line 23

Compilation aborted.
4 Errors.
Could not locate output file C:\Users\Usuario\Desktop\ze_extra_unlimited_clip.amx (compile failed).
Responder
#4
te faltaba la librería hamsandwich

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

// 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")
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1
}
public 
fw_PlayerSpawn_Post(id)
{
    
g_has_unlimited_clip[id] = false 
}
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);

(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


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)