搜索
查看: 4779|回复: 3

关于超级手雷插件,版主来瞧瞧!

[复制链接]
发表于 2007-4-3 14:22:35 | 显示全部楼层 |阅读模式 来自 中国–广东–广州
如何改才能使中雷者即死或血减少至10以下,并且攻击者加杀人数!


#include <amxmodx>
#include <cstrike>
#include <fun>
#include <engine>
#include <fakemeta>
new bool:hasHE[33]
new price
new bool:buy_allow[33]
new bool:buying
// new gmsgDeathMsg // For 1.1 use
public plugin_init() {
register_plugin("Super HEGRENADEs", "1.0.2", "pcboy")
// gmsgDeathMsg = get_user_msgid("DeathMsg") // For 1.1 use
register_cvar("suphe_version", "1.0.2")
register_cvar("amx_supnades", "1")
register_cvar("amx_suphecost", "2000")
register_clcmd("say /showprices", "showPrices")
register_clcmd("say /buysuperlei", "buyHe")
register_event("ResetHUD", "advertiseSupHE", "b")
register_event("Damage", "Damage_event", "b", "2>0")
set_task(1.0, "checkCost")
register_event("StatusIcon", "buyzone_icon", "be", "2=buyzone")
register_event("RoundTime", "RoundTime_event", "bc")
}
/*
public client_connect(id) {
hasHE[id] = false
}
public client_disconnect(id) {
hasHE[id] = false
}
*/
public checkCost() {
price = get_cvar_num("amx_suphecost")
if (price <= 0) {
set_cvar_num("amx_suphecost", 2000)
server_print("[www.migao.org][Super HEGRENADEs] The cost of a super HEGRENADE has been changed to $2000 due to the value is too low.")
}
if (price > 200000) {
set_cvar_num("amx_suphecost", 2000)
server_print("[www.migao.org][Super HEGRENADEs] The cost of a super HEGRENADE has been changed to $2000 due to the value is too high.")
}
set_task(1.0, "checkCost")
}
public advertiseSupHE(id) {
price = get_cvar_num("amx_suphecost")
if(!get_cvar_num("amx_supnades")) return PLUGIN_HANDLED
client_print(id, print_chat, "[www.migao.org] Super HEGRENADEs is enabled on this server.")
client_print(id, print_chat, "[www.migao.org] 1 Super HEGRENADE costs $%i.", price)
client_print(id, print_chat, "[www.migao.org] Say ^"/buysuperlei^" to buy one super HEGRENADE or press j buy.")
return PLUGIN_HANDLED
}
public showPrices(id) {
price = get_cvar_num("amx_suphecost")
if (!get_cvar_num("amx_supnades")) {
client_print(id, print_chat, "[www.migao.org] The plugin is disabled!")
return PLUGIN_HANDLED
}
client_print(id, print_chat, "[www.migao.org] A super HEGRENADE costs $%i.", price)
client_print(id, print_chat, "[www.migao.org] Say ^"/buysuperlei^" to buy one super HEGRENADE or press j buy.")
return PLUGIN_HANDLED
}
public buyHe(id) {
price = get_cvar_num("amx_suphecost")
if (!get_cvar_num("amx_supnades")) {
client_print(id, print_chat, "[www.migao.org] The plugin is disabled!")
return PLUGIN_HANDLED
}
if(!is_user_alive(id)) {
client_print(id, print_chat, "[www.migao.org] Dead men buy nothing.")
return PLUGIN_HANDLED
}
new myMoney = cs_get_user_money(id)
new myMoneyleft = myMoney-price
if (price > myMoney) {
client_print(id , print_center , "You have insufficient funds!")
client_print(id, print_chat, "[www.migao.org] You can't buy a super HEGRENADE because you don't have enough money.")
client_print(id, print_chat, "[www.migao.org] A super HEGRENADE costs $%i.", price)
return PLUGIN_HANDLED
}
if (cs_get_user_bpammo(id, CSW_HEGRENADE) == 1) {
client_print(id, print_center, "You cannot carry anymore!")
return PLUGIN_HANDLED
}
if(buying && buy_allow[id])
{
cs_set_user_money(id, myMoneyleft)
//hasHE[id] = true
client_print(id, print_chat, "[www.migao.org] You have just bought a super HEGRENADE for $%i.", price)
give_item(id, "weapon_hegrenade")
}
else if(!buying) engclient_print(id, engprint_center, "%i seconds have passed.^nYou can't buy anything now!", floatround(get_cvar_float("mp_buytime") * 60))
return PLUGIN_HANDLED
}
public Damage_event(id) {
new wpn, body, attacker = get_user_attacker(id, wpn, body)
// Its a Grenade
if(wpn == 4 && hasHE[attacker])
{
  new Float:hp = float(get_user_health(id))
  new Float:dmg = float(read_data(2))
  dmg *= 0.5
  new Float:damage =hp - dmg*4
  kill_player(id,attacker,Float:damage)
}
}
public kill_player(id,attacker,Float:damage){
set_msg_block(get_user_msgid("DeathMsg"),BLOCK_ONCE)
fakedamage(id,"trigger_hurt",damage,0)
//if (entity_get_float(id,EV_FL_health) <= 0.0){
if (damage <= 0.0){
  if ( attacker ){
   message_begin( MSG_ALL, get_user_msgid("DeathMsg"))
   write_byte(attacker)
   write_byte(id)
   write_string("name of weapon")// i dont know the name of he grenade, this change the skull icon to another icon
   message_end()
  }
}
}
public buyzone_icon(id)
{
if(read_data(1))
{
if(!buying) buy_allow[id] = false
else buy_allow[id] = true
}
else buy_allow[id] = false
}
public RoundTime_event()
{
new Float:roundtime = get_cvar_float("mp_roundtime") * 60.0
new rtime = read_data(1)
if(get_cvar_num("mp_freezetime") == rtime)
{
if(task_exists(5681)) remove_task(5681)
}
buying = true
if(roundtime == rtime)
{
new Float:buy_time = get_cvar_float("mp_buytime") * 60
set_task(buy_time, "buy_task", 5681)
}
}
public buy_task()
{
buying = false
}
发表于 2010-2-7 13:36:10 | 显示全部楼层 来自 中国–福建–泉州–安溪县
做个记号
回复

使用道具 举报

发表于 2010-8-15 08:41:30 | 显示全部楼层 来自 中国–湖北–武汉
这个是源码?可惜我不懂的说....
回复

使用道具 举报

发表于 2013-2-14 14:23:00 | 显示全部楼层 来自 中国–辽宁–鞍山–海城市
这个是源码?可惜我不懂的说....
回复

使用道具 举报

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

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