wan482
发表于 2009-5-15 14:25:11
:lol
在测试下
jakyotwins拜你为师好不,看你的短消息,加我Q
jakyotwins
发表于 2009-5-15 14:28:05
我也刚学不久而已..
landyhmm
发表于 2009-5-15 17:15:46
官网上有sellweapons 搜索
LittleKu
发表于 2009-5-15 19:46:20
本帖最后由 kk阿朗 于 2009-5-15 21:57 编辑
Hey!!!jakyotwins
I have some advice,how do you think about this?#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
// 是否使用无限金钱
//#define UNLIMITEDMONEY
#if defined UNLIMITEDMONEY
#include <Unlimited_money>
#endif
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)
#define STUNT_SELECTION (g_menu_data+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("say", "checksay")
register_clcmd("say_team", "checksay")
sl_price= register_cvar("sl_price", "50") // 出售的武器打折数,默认半折
}
public client_putinserver(id)
{
new param, len
param = id
len = get_user_name(id,param,31)
set_task(4.0, "enter_msg", 0, param,len + 4)
return PLUGIN_CONTINUE
}
public enter_msg(param[])
{
client_print(param, print_chat, "* 按'Y'或'U',输入'/sellweapon'或'sellweapon',进行武器出售")
}
// 技能选择面版
public show_menu_weapon(id)
{
if (!is_user_alive(id))
{
client_print(id, print_center, "只有活着的人才能出售武器!")
return PLUGIN_HANDLED
}
if (cs_get_user_buyzone(id) == 0)
{
client_print(id, print_center, "你必需在购买武器区域才能出售武器!")
return PLUGIN_HANDLED
}
static menu, len
new stu_key = 1
len = 0
// 标题
len += formatex(menu, sizeof menu - 1 - len, "\y出售武器^n^n")
new weapStr, iNum
get_user_weapons(id, weapStr, iNum)
for(new i = 0; i < iNum; i++)
{
if (iNum>9)
{
break;
}
switch(weapStr)
{
case CSW_HEGRENADE,CSW_C4,CSW_ELITE,CSW_VEST,CSW_VESTHELM,CSW_KNIFE,CSW_SMOKEGRENADE,CSW_FLASHBANG:
{
}
default:
{
len += formatex(menu, sizeof menu - 1 - len, "\r%d.\w%s \y $%d^n", stu_key,WEAPONNAMES],(WEAPONMONEYS] / 100 * get_pcvar_num(sl_price)))
stu_key++
}
}
}
len += formatex(menu, 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, iNum,stu_key=0,weaponName
get_user_weapons(id, weapStr, iNum)
for(new i = 0; i < iNum; i++)
{
if (iNum>9)
{
break;
}
switch(weapStr)
{
case CSW_HEGRENADE,CSW_C4,CSW_ELITE,CSW_VEST,CSW_VESTHELM,CSW_KNIFE,CSW_SMOKEGRENADE,CSW_FLASHBANG:{}
default:
{
if (stu_key==key)
{
#if defined UNLIMITEDMONEY
add_money_um(id,(WEAPONMONEYS] / 100 * get_pcvar_num(sl_price)))
#else
add_money(id,(WEAPONMONEYS] / 100 * get_pcvar_num(sl_price)))
#endif
client_print(id, print_chat, "你卖出了%s,获得了$%d",WEAPONNAMES],(WEAPONMONEYS] / 100 * get_pcvar_num(sl_price)))
get_weaponname(weapStr, 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)
// dllfunc(DLLFunc_Think, ent_box)
return PLUGIN_HANDLED;
}
stu_key++
}
}
}
return PLUGIN_HANDLED;
}
public add_money(id,value)
{
if (cs_get_user_money(id) + value >= 16000)
{
cs_set_user_money(id,16000,1)
}
else
{
cs_set_user_money(id,cs_get_user_money(id) + value,1)
}
}
public checksay(id)
{
new said
read_args(said, 31)
if (equali(said, "^"/sellweapon^"") || equali(said, "^"sellweapon^""))
show_menu_weapon(id)
return PLUGIN_CONTINUE
}
stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0)
{
new strtype = "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
}
jakyotwins
发表于 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, "你不能出售此武器")
这个你写在菜单里面干嘛..
LittleKu
发表于 2009-5-15 21:01:42
本帖最后由 kk阿朗 于 2009-5-15 21:57 编辑
25# jakyotwins
any problem
oh yeah ,I 'm so sorry!!!
ty772076348
发表于 2009-6-29 18:05:18
好好很好:victory::):victory::victory:好好
yangderui025
发表于 2011-3-16 11:17:52
怎么源码不能编译啊?
yangderui025
发表于 2011-3-16 17:20:10
能不能扔掉5秒就变成现金?
wk703
发表于 2011-4-2 10:38:59
呵呵插件越来越逗了