搜索
楼主: wan482

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

[复制链接]
 楼主| 发表于 2009-5-15 14:25:11 | 显示全部楼层 来自 广东深圳
:lol
在测试下
jakyotwins  拜你为师好不,看你的短消息,加我Q
回复

使用道具 举报

发表于 2009-5-15 14:28:05 | 显示全部楼层 来自 广东深圳
我也刚学不久而已..
回复

使用道具 举报

发表于 2009-5-15 17:15:46 | 显示全部楼层 来自 吉林长春
官网上有sellweapons 搜索
回复

使用道具 举报

发表于 2009-5-15 19:46:20 | 显示全部楼层 来自 广东广州
本帖最后由 kk阿朗 于 2009-5-15 21:57 编辑

Hey!!!jakyotwins
I have some advice,how do you think about this?
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fakemeta>
  4. #include <cstrike>


  5. // 是否使用无限金钱
  6. //#define UNLIMITEDMONEY


  7. #if defined UNLIMITEDMONEY
  8. #include <Unlimited_money>
  9. #endif
  10. const KEYSMENU = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
  11. const MENU_KEY_EXIT = 9
  12. #define STUNT_COUNT 16
  13. #define STUNT_STARTID (g_menu_data[id][7])
  14. #define STUNT_SELECTION (g_menu_data[id][7]+key)


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

  27. 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}

  28. new sl_price

  29. public plugin_init()
  30. {
  31.         register_plugin("Sale Weapon", "1.0", "Jakyo")
  32.         register_menu("Stunt weapon Menu", KEYSMENU, "menu_weaponselect")
  33.         register_clcmd("say", "checksay")
  34.         register_clcmd("say_team", "checksay")
  35.         sl_price  = register_cvar("sl_price", "50")                        // 出售的武器打折数,默认半折
  36. }

  37. public client_putinserver(id)
  38. {
  39.         new param[34], len
  40.         param[0] = id
  41.         len = get_user_name(id,param[1],31)
  42.         set_task(4.0, "enter_msg", 0, param,len + 4)
  43.         return PLUGIN_CONTINUE
  44. }

  45. public enter_msg(param[])
  46. {
  47.         client_print(param[0], print_chat, "* 按'Y'或'U',输入'/sellweapon'或'sellweapon',进行武器出售")
  48. }

  49. // 技能选择面版
  50. public show_menu_weapon(id)
  51. {
  52.         if (!is_user_alive(id))
  53.         {
  54.                 client_print(id, print_center, "只有活着的人才能出售武器!")
  55.                 return PLUGIN_HANDLED
  56.         }
  57.         if (cs_get_user_buyzone(id) == 0)
  58.         {
  59.                 client_print(id, print_center, "你必需在购买武器区域才能出售武器!")
  60.                 return PLUGIN_HANDLED
  61.         }
  62.        
  63.         static menu[2048], len
  64.         new stu_key = 1
  65.         len = 0
  66.        
  67.         // 标题
  68.         len += formatex(menu[len], sizeof menu - 1 - len, "\y出售武器^n^n")
  69.        
  70.         new weapStr[32], iNum
  71.         get_user_weapons(id, weapStr, iNum)
  72.         for(new i = 0; i < iNum; i++)
  73.         {
  74.                 if (iNum>9)
  75.                 {
  76.                         break;
  77.                 }
  78.                 switch(weapStr[i])
  79.                 {
  80.                         case CSW_HEGRENADE,CSW_C4,CSW_ELITE,CSW_VEST,CSW_VESTHELM,CSW_KNIFE,CSW_SMOKEGRENADE,CSW_FLASHBANG:
  81.                         {
  82.                        
  83.                         }
  84.                         default:
  85.                         {
  86.                                 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)))
  87.                                 stu_key++
  88.                         }
  89.                 }
  90.         }
  91.         len += formatex(menu[len], sizeof menu - 1 - len, "^n^n\r0.\w 退出")
  92.         show_menu(id, KEYSMENU, menu, -1, "Stunt weapon Menu")
  93.         return PLUGIN_HANDLED;
  94. }

  95. public menu_weaponselect(id,key)
  96. {
  97.         if (!is_user_alive(id))
  98.                 return PLUGIN_HANDLED
  99.        
  100.         new weapStr[32], iNum,stu_key=0,weaponName[32]
  101.         get_user_weapons(id, weapStr, iNum)
  102.         for(new i = 0; i < iNum; i++)
  103.         {
  104.                 if (iNum>9)
  105.                 {
  106.                         break;
  107.                 }
  108.                 switch(weapStr[i])
  109.                 {
  110.                         case CSW_HEGRENADE,CSW_C4,CSW_ELITE,CSW_VEST,CSW_VESTHELM,CSW_KNIFE,CSW_SMOKEGRENADE,CSW_FLASHBANG:{}
  111.                         default:
  112.                         {
  113.                                 if (stu_key==key)
  114.                                 {
  115.                                         #if defined UNLIMITEDMONEY
  116.                                         add_money_um(id,(WEAPONMONEYS[weapStr[i]] / 100 * get_pcvar_num(sl_price)))
  117.                                         #else
  118.                                         add_money(id,(WEAPONMONEYS[weapStr[i]] / 100 * get_pcvar_num(sl_price)))
  119.                                         #endif
  120.                                         client_print(id, print_chat, "你卖出了%s,获得了$%d",WEAPONNAMES[weapStr[i]],(WEAPONMONEYS[weapStr[i]] / 100 * get_pcvar_num(sl_price)))
  121.                                         get_weaponname(weapStr[i], weaponName, sizeof(weaponName)-1)
  122.                                         new ent_weap = fm_find_ent_by_owner(-1, weaponName, id)
  123.                                         engclient_cmd(id, "drop", weaponName)
  124.                                         new ent_box = pev(ent_weap, pev_owner)
  125.                                         if (!ent_box || ent_box == id)
  126.                                                 return PLUGIN_HANDLED
  127.                                         engfunc(EngFunc_RemoveEntity, ent_box)
  128.                                         //        dllfunc(DLLFunc_Think, ent_box)
  129.                                         return PLUGIN_HANDLED;
  130.                                 }
  131.                                 stu_key++
  132.                         }
  133.                 }
  134.         }
  135.         return PLUGIN_HANDLED;
  136. }

  137. public add_money(id,value)
  138. {
  139.         if (cs_get_user_money(id) + value >= 16000)
  140.         {
  141.                 cs_set_user_money(id,16000,1)
  142.         }
  143.         else
  144.         {
  145.                 cs_set_user_money(id,cs_get_user_money(id) + value,1)
  146.         }
  147. }

  148. public checksay(id)
  149. {
  150.         new said[32]
  151.         read_args(said, 31)
  152.        
  153.         if (equali(said, "^"/sellweapon^"") || equali(said, "^"sellweapon^""))
  154.                 show_menu_weapon(id)
  155.         return PLUGIN_CONTINUE
  156. }

  157. stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0)
  158. {
  159.         new strtype[11] = "classname", ent = index
  160.         switch (jghgtype)
  161.         {
  162.                 case 1: strtype = "target"
  163.                 case 2: strtype = "targetname"
  164.         }
  165.         while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}
  166.        
  167.         return ent
  168. }
复制代码
回复

使用道具 举报

发表于 2009-5-15 20:52:52 | 显示全部楼层 来自 广东深圳
set_hudmessage(255, 127, 255, -1.0, -1.0, 1, 6.0, 6.0, 0.5, 0.15, 3)

                                show_hudmessage(id, "你不能出售此武器")

这个你写在菜单里面干嘛..
回复

使用道具 举报

发表于 2009-5-15 21:01:42 | 显示全部楼层 来自 广东广州
本帖最后由 kk阿朗 于 2009-5-15 21:57 编辑

25# jakyotwins


any problem

oh yeah ,I 'm so sorry!!!
回复

使用道具 举报

发表于 2009-6-29 18:05:18 | 显示全部楼层 来自 河南信阳
好好很好:victory::):victory::victory:好好
回复

使用道具 举报

发表于 2011-3-16 11:17:52 | 显示全部楼层 来自 陕西宝鸡
怎么源码不能编译啊?
回复

使用道具 举报

发表于 2011-3-16 17:20:10 | 显示全部楼层 来自 四川成都
能不能扔掉5秒就变成现金?
回复

使用道具 举报

发表于 2011-4-2 10:38:59 | 显示全部楼层 来自 湖南
呵呵插件越来越逗了
回复

使用道具 举报

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

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