搜索
查看: 7380|回复: 29

[AMXX 带源码] 突发创意,cs1.6卖出手上武器

[复制链接]
发表于 2009-5-14 21:27:23 | 显示全部楼层 |阅读模式 来自 中国–广东–深圳–宝安区
本帖最后由 wan482 于 2009-5-15 14:47 编辑

游戏中是否经常发现地上的武器丢那里太可惜
想要这把又想要那把,最终只能选择一把
所以
能把武器卖掉换成$ :D

很不错的注意吧

会编写插件的兄弟姐妹都来看下怎么写这个插件
我看了两天写插件的资料还是一头雾水
EN文不行没办法了,请大家一起来...

--------------------------------------------------------

感谢 点通会员 "jakyotwins" 编写的卖出武器插件
插件测试已经可以正常使用,在进一步测试中.
需要插件的请到19楼下载
发表于 2009-5-14 22:27:25 | 显示全部楼层 来自 中国–广西–百色
{:3_47:}

[原创作品] 突发创意,cs1.6卖出手上武器

我以为已经有了呢?
回复

使用道具 举报

发表于 2009-5-14 23:01:34 | 显示全部楼层 来自 中国–广东–深圳–福田区
想怎么个方式卖?
打命令按出菜单?
回复

使用道具 举报

 楼主| 发表于 2009-5-14 23:09:17 | 显示全部楼层 来自 中国–广东–深圳–宝安区
肯定是命令了
比如say /maiwq
然后就出一个确认选单
回复

使用道具 举报

发表于 2009-5-14 23:27:34 | 显示全部楼层 来自 中国–广东–深圳–福田区
哦...稍等,我现在给你写
回复

使用道具 举报

发表于 2009-5-15 00:42:49 | 显示全部楼层 来自 中国–广东–深圳–福田区
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <Unlimited_money>

const KEYSMENU = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
const MENU_KEY_EXIT = 9
#define STUNT_COUNT 16
#define STUNT_STARTID (g_menu_data[id][7])
#define STUNT_SELECTION (g_menu_data[id][7]+key)


new const WEAPONNAMES[][] = { "", "P228 Compact", "", "Schmidt Scout", "", "XM1014 M4", "", "Ingram MAC-10", "Steyr AUG A1",
                        "", "Dual Elite Berettas", "FiveseveN", "UMP 45", "SG-550 Auto-Sniper", "IMI Galil", "Famas",
                        "USP .45 ACP Tactical", "Glock 18C", "AWP Magnum Sniper", "MP5 Navy", "M249 Para Machinegun",
                        "M3 Super 90", "M4A1 Carbine", "Schmidt TMP", "G3SG1 Auto-Sniper", "", "Desert Eagle .50 AE",
                        "SG-552 Commando", "AK-47 Kalashnikov", "", "ES P90" }

new const WEAPONMONEYS[] = {0,450,0,2750,0,3000,0,1250,3500,0,800,750,1700,4200,2000,2250,500,600,4750,1500,5750,1700,3100,1250,4750,0,650,3500,2750,0,2350}

new sl_price

public plugin_init()
{
        register_plugin("Sale Weapon", "1.0", "Jakyo")
        register_menu("Stunt weapon Menu", KEYSMENU, "menu_weaponselect")
        register_clcmd("saleweapon", "show_menu_weapon")
        register_clcmd("say /maiwq", "show_menu_weapon")
        register_clcmd("say /saleweapon", "show_menu_weapon")
        sl_price  = register_cvar("sl_price", "50")                        // 出售的武器打折数,默认半折
}






// 技能选择面版
public show_menu_weapon(id)
{
        if (!is_user_alive(id))
        {       
                return PLUGIN_HANDLED
        }

        static menu[2048], len
        new stu_key=1
        len = 0
       
        // 标题
        len += formatex(menu[len], sizeof menu - 1 - len, "\y出售武器^n^n")
       

        new weapStr[32], iNum
        get_user_weapons(id, weapStr, iNum)
        for(new i = 0; i < iNum; i++)
        {
                if (iNum>9)
                {
                        break;
                }
                switch(weapStr[i])
                {
                        case CSW_HEGRENADE,CSW_C4,CSW_ELITE,CSW_VEST,CSW_VESTHELM,CSW_KNIFE,CSW_SMOKEGRENADE,CSW_FLASHBANG:
                        {
                               
                        }
                        default:
                        {
                                len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w%s \y $%d^n", stu_key,WEAPONNAMES[weapStr[i]],(WEAPONMONEYS[weapStr[i]] / 100 * get_pcvar_num(sl_price)))
                                stu_key++
                        }
                }
        }

        len += formatex(menu[len], sizeof menu - 1 - len, "^n^n\r0.\w 退出")
        show_menu(id, KEYSMENU, menu, -1, "Stunt weapon Menu")
        return PLUGIN_HANDLED;
}

public menu_weaponselect(id,key)
{
        if (!is_user_alive(id))
                return PLUGIN_HANDLED

        new weapStr[32], iNum,stu_key=0,weaponName[32]
        get_user_weapons(id, weapStr, iNum)
        for(new i = 0; i < iNum; i++)
        {
                if (iNum>9)
                {
                        break;
                }
                switch(weapStr[i])
                {
                        case CSW_HEGRENADE,CSW_C4,CSW_ELITE,CSW_VEST,CSW_VESTHELM,CSW_KNIFE,CSW_SMOKEGRENADE,CSW_FLASHBANG:
                        {
                               
                        }
                        default:
                        {
                                if (stu_key==key)
                                {
                                        add_money_um(id,(WEAPONMONEYS[weapStr[i]] / 100 * get_pcvar_num(sl_price)))
                                        client_print(id, print_chat, "你卖出了%s,获得了$%d",WEAPONNAMES[weapStr[i]],(WEAPONMONEYS[weapStr[i]] / 100 * get_pcvar_num(sl_price)))
                                        get_weaponname(weapStr[i], weaponName, sizeof(weaponName)-1)
                                        new ent_weap = fm_find_ent_by_owner(-1, weaponName, id)
                                        engclient_cmd(id, "drop", weaponName)
                                        new ent_box = pev(ent_weap, pev_owner)
                                              if (!ent_box || ent_box == id)
                                        {
                                                return PLUGIN_HANDLED
                                        }
                                        engfunc(EngFunc_RemoveEntity, ent_box)
                                        return PLUGIN_HANDLED;
                                }
                                stu_key++
                        }
                }
        }
        return PLUGIN_HANDLED;
}

stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0)
{
  new strtype[11] = "classname", ent = index
  switch (jghgtype)
  {
  case 1: strtype = "target"
  case 2: strtype = "targetname"
  }
  while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner)
  {

  }

  return ent
}

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
回复

使用道具 举报

发表于 2009-5-15 00:43:07 | 显示全部楼层 来自 中国–广东–深圳–福田区
测试通过,需调用无限金钱插件
回复

使用道具 举报

发表于 2009-5-15 00:43:46 | 显示全部楼层 来自 中国–广东–深圳–福田区
使用
say /maiwq
say /saleweapon
打开菜单
回复

使用道具 举报

发表于 2009-5-15 00:44:12 | 显示全部楼层 来自 中国–广东–深圳–福田区
......为什么我的点通币是负的呢..
回复

使用道具 举报

 楼主| 发表于 2009-5-15 11:39:02 | 显示全部楼层 来自 中国–广东–深圳–宝安区
:D
测试下先
先谢谢楼上朋友的参与
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表