关于超级手雷插件,版主来瞧瞧!
如何改才能使中雷者即死或血减少至10以下,并且攻击者加杀人数!#include <amxmodx>
#include <cstrike>
#include <fun>
#include <engine>
#include <fakemeta>
new bool:hasHE
new price
new bool:buy_allow
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 = false
}
public client_disconnect(id) {
hasHE = false
}
*/
public checkCost() {
price = get_cvar_num("amx_suphecost")
if (price <= 0) {
set_cvar_num("amx_suphecost", 2000)
server_print("[www.migao.org] 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] 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)
{
cs_set_user_money(id, myMoneyleft)
//hasHE = 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)
{
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 = false
else buy_allow = true
}
else buy_allow = 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
} 做个记号 这个是源码?可惜我不懂的说.... 这个是源码?可惜我不懂的说....
页:
[1]