注册 登录
MOD中国同盟社 返回首页

编程爱好者 http://www.modchina.com/?25792 [收藏] [复制] [分享] [RSS] 空间主要记录一些AMXX代码

日志

无限弹药

热度 4已有 660 次阅读2011-5-18 19:31 |个人分类:Amxx调试

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Unlimited Clip Ammo"
#define VERSION "1.0"
#define AUTHOR "-Acid-"

// weapons offsets
#define OFFSET_CLIPAMMO        51
#define OFFSET_LINUX_WEAPONS    4
#define fm_cs_set_weapon_ammo(%1,%2)    set_pdata_int(%1, OFFSET_CLIPAMMO, %2, OFFSET_LINUX_WEAPONS)

// players offsets
#define m_pActiveItem 373

const NOCLIP_WPN_BS    = ((1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4))

new const g_MaxClipAmmo[] = 
{
    0,
    13, //CSW_P228
    0,
    10, //CSW_SCOUT
    0,  //CSW_HEGRENADE
    7,  //CSW_XM1014
    0,  //CSW_C4
    30,//CSW_MAC10
    30, //CSW_AUG
    0,  //CSW_SMOKEGRENADE
    15,//CSW_ELITE
    20,//CSW_FIVESEVEN
    25,//CSW_UMP45
    30, //CSW_SG550
    35, //CSW_GALIL
    25, //CSW_FAMAS
    12,//CSW_USP
    20,//CSW_GLOCK18
    10, //CSW_AWP
    30,//CSW_MP5NAVY
    100,//CSW_M249
    8,  //CSW_M3
    30, //CSW_M4A1
    30,//CSW_TMP
    20, //CSW_G3SG1
    0,  //CSW_FLASHBANG
    7,  //CSW_DEAGLE
    30, //CSW_SG552
    30, //CSW_AK47
    0,  //CSW_KNIFE
    50//CSW_P90
}

public plugin_init() 
{
    register_plugin( PLUGIN , VERSION , AUTHOR );
    register_event("CurWeapon" , "Event_CurWeapon" , "be" , "1=1" );
}

public Event_CurWeapon( id )
{
    new iWeapon = read_data(2)
    if( !( NOCLIP_WPN_BS & (1<<iWeapon) ) )
    {
        fm_cs_set_weapon_ammo( get_pdata_cbase(id, m_pActiveItem) , g_MaxClipAmmo[ iWeapon ] )
    }
}
============================================================
(2)
============================================================
#include <amxmodx>
#include <fakemeta>

#define VERSION "0.0.1"

enum
{
AmmoX_AmmoID = 1,
AmmoX_Ammount
}

enum
{
ammo_none,
ammo_338magnum = 1, // 30
ammo_762nato, // 90
ammo_556natobox, // 200
ammo_556nato, // 90
ammo_buckshot, // 32
ammo_45acp, // 100
ammo_57mm, // 100
ammo_50ae, // 35
ammo_357sig, // 52
ammo_9mm, // 120
ammo_flashbang, // 2
ammo_hegrenade, // 1
ammo_smokegrenade, // 1
ammo_c4 // 1
}

new const g_iMaxBpAmmo[] = {
0,
30,
90,
200,
90,
32,
100,
100,
35,
52,
120,
2,
1,
1,
1
}

#define XO_PLAYER 5
#define m_rgpPlayerItems_0 376

public plugin_init()
{
register_plugin("Infinite BpAmmo", VERSION, "ConnorMcLeod")
register_message(get_user_msgid("AmmoX"), "Message_AmmoX")
}

public Message_AmmoX(iMsgId, iMsgDest, id)
{
new iAmmoID = get_msg_arg_int(AmmoX_AmmoID)

if( is_user_alive(id) && iAmmoID )
{
new iMaxBpAmmo = g_iMaxBpAmmo[iAmmoID]
if( get_msg_arg_int(AmmoX_Ammount) < iMaxBpAmmo )
{
#if defined UNLIMITED_NADES
if( iAmmoID < ammo_c4 )
#else
if( iAmmoID <= ammo_9mm )
#endif
{
set_msg_arg_int(AmmoX_Ammount, ARG_BYTE, iMaxBpAmmo)
set_pdata_int(id, m_rgpPlayerItems_0 + iAmmoID, iMaxBpAmmo, XO_PLAYER)
}
}
}
}


路过
1

鸡蛋
1

鲜花
2

握手

雷人

刚表态过的朋友 (4 人)

收藏 分享 转发到开心网 举报

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册
验证问答 换一个 验证码 换一个

回顶部