|
楼主 |
发表于 2012-8-26 15:39:13
|
显示全部楼层
来自 中国–河北–保定
代码为乌龟原创,朋友需要 帮忙修改~
大家用得上就用- #include <amxmodx>
- #include <amxmisc>
- #include <cstrike>
- #include <fun>
- #define PLUGIN "o4 +3 4 5"
- #define VERSION "1.0"
- #define AUTHOR "原wugui作品,Kyo半仙修改"
- new g_MsgidTextMsg, g_Buymoney, Float:g_GameTime;
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR);
-
-
- register_logevent("EventStartRound", 2, "0=World triggered", "1=Round_Start");
- register_event("HLTV", "EventStartRound", "a", "1=0", "2=0");
-
- register_menucmd(register_menuid("BuyItem", 1), 511, "menuItem");
- g_Buymoney = register_cvar("amx_grenade_money", "300");
-
-
- g_MsgidTextMsg = get_user_msgid("TextMsg");
- }
- public EventStartRound()
- g_GameTime = get_gametime();
- public menuItem(id, key)
- {
- if(key == 3)
- {
- buy_hegren(id);
- return PLUGIN_HANDLED;
- }
- return PLUGIN_CONTINUE;
- }
- public client_command(id)
- {
- new arg[13];
- if(read_argv(0, arg, 12) > 11) return PLUGIN_CONTINUE;
-
- if(equali(arg, "hegren"))
- {
- buy_hegren(id);
- return PLUGIN_HANDLED;
- }
-
- return PLUGIN_CONTINUE;
- }
- public buy_hegren(id)
- {
- new Float:buytime, Float:timepassed, g_money, g_currentHE, CannotTime[5];
-
- timepassed = get_gametime() - g_GameTime;
-
- buytime = get_cvar_float("mp_buytime") * 60.0;
-
- if(!is_user_connected(id)) return PLUGIN_HANDLED;
-
- if(!cs_get_user_buyzone(id)) return PLUGIN_HANDLED;
-
- if(floatcmp(timepassed , buytime) == 1)
- {
- num_to_str(floatround(get_cvar_float("mp_buytime") * 60.0, floatround_round), CannotTime, charsmax(CannotTime));
-
- buy_message(id, "#Cant_buy", CannotTime);
- return PLUGIN_HANDLED;
- }
-
- g_money = cs_get_user_money(id);
-
- if(g_money < get_pcvar_num(g_Buymoney))
- {
- buy_message(id, "#Not_Enough_Money", "");
- return PLUGIN_HANDLED;
- }
-
- g_currentHE = cs_get_user_bpammo(id, CSW_HEGRENADE);
-
- if(g_currentHE == 0)
- {
- give_item(id, "weapon_hegrenade");
- cs_set_user_money(id, g_money - 300);
- }
- else
- {
-
- if(get_user_flags(id) & ADMIN_LEVEL_A)
- {
- if(g_currentHE <= 4)
- {
- new ikyot[112],K_name[32]
- get_user_name(id, K_name, 31);
- cs_set_user_bpammo(id, CSW_HEGRENADE, 0);
- give_item (id, "weapon_hegrenade");
- cs_set_user_bpammo(id, CSW_HEGRENADE, g_currentHE + 1);
- cs_set_user_money(id, g_money - 300);
- format(ikyot,111,"^x04 %s^x03使用多雷卡^x04购买手雷,他最多可带5个手雷",K_name)
- client_color(0, id, ikyot)
- }
- else
- {
- buy_message(id, "#Cannot_Carry_Anymore", "");
- }
- }
- if(get_user_flags(id) & ADMIN_LEVEL_B)
- {
- if(g_currentHE <= 3)
- {
- new ikyot[112],K_name[32]
- get_user_name(id, K_name, 31);
- cs_set_user_bpammo(id, CSW_HEGRENADE, 0);
- give_item (id, "weapon_hegrenade");
- cs_set_user_bpammo(id, CSW_HEGRENADE, g_currentHE + 1);
- cs_set_user_money(id, g_money - 300);
- format(ikyot,111,"^x04 %s^x03使用多雷卡^x04购买手雷,他最多可带4个手雷",K_name)
- client_color(0, id, ikyot)
- }
- else
- {
- buy_message(id, "#Cannot_Carry_Anymore", "");
- }
- }
- if(get_user_flags(id) & ADMIN_LEVEL_C)
- {
- if(g_currentHE <= 2)
- {
- new ikyot[112],K_name[32]
- get_user_name(id, K_name, 31);
- cs_set_user_bpammo(id, CSW_HEGRENADE, 0);
- give_item (id, "weapon_hegrenade");
- cs_set_user_bpammo(id, CSW_HEGRENADE, g_currentHE + 1);
- cs_set_user_money(id, g_money - 300);
- format(ikyot,111,"^x04 %s^x03使用多雷卡^x04购买手雷,他最多可带3个手雷",K_name)
- client_color(0, id, ikyot)
- }
- else
- {
- buy_message(id, "#Cannot_Carry_Anymore", "");
- }
- }
- else
- { buy_message(id, "#Cannot_Carry_Anymore", "")
- }
- }
- return PLUGIN_HANDLED;
- }
- public buy_message(id, message[], more[])
- {
- message_begin(MSG_ONE, g_MsgidTextMsg, _, id);
- write_byte(4);
- write_string(message);
- if(strlen(more) > 0)
- write_string(more);
- message_end();
- }
- public client_color(playerid,colorid,msg[])
- {
- message_begin(playerid?MSG_ONE:MSG_ALL, get_user_msgid("SayText"), {0,0,0}, playerid)
- write_byte(colorid)
- write_string(msg)
- message_end()
- }
复制代码 |
|