|
发表于 2007-12-6 16:10:53
|
显示全部楼层
|阅读模式
来自 中国–广东–广州–白云区
对T加钱
开局前5名杀人奖励,只对土匪加钱;
当CT第一个杀人时不奖励,第二个CT杀人也不奖励。只对土匪在前5名杀人时候奖励!
[php]/*
* AMXMOD script.
* (plugin_bonus1.sma)
* by DreamZSW <DreamZSW@hotmail.com>
* This file is provided as is (no warranties).
*
*/
#include <amxmod>
#define MAX_NAME_LENGTH 32
#define MAX_TEXT_LENGTH 512
#define ACCESS_LEVEL ADMIN_LEVEL_A
// Default on/off
new gBonusMode = 1
new bool:gRoundStart //增加行
new gBonusCount = 0
new gBonusIndex[5] = { 2000,1600,1200,1000,800 }
// 用于不需要重复定义(临时)
new _tmpStr[256]
public admin_bonuskill(id)
{
// Check access level
if (!(get_user_flags(id)&ACCESS_LEVEL)) {
console_print(id,"[注意] 你没有权限使用这个命令!")
return PLUGIN_HANDLED
}
// Check arguments
if (read_argc() < 2) {
console_print(id,"[注意] 使用格式为: money_bonus < 1 | 0 >")
return PLUGIN_HANDLED
}
new sArg1[MAX_NAME_LENGTH]
read_argv(1,sArg1,MAX_NAME_LENGTH)
if (str_to_num(sArg1)) {
gBonusMode = 1
client_print(id,print_chat,"[Money_Bonus] 前五名杀人奖励插件已启用.")
}
else {
gBonusMode = 0
client_print(id,print_chat,"[Money_Bonus] 前五名杀人奖励插件已关闭.")
}
return PLUGIN_HANDLED
}
public event_death()
{
if (gBonusMode && gRoundStart) { // 修改
new iKiller = read_data(1)
new iVictim = read_data(2)
new sMsg[MAX_TEXT_LENGTH]
new sName[MAX_NAME_LENGTH]
get_user_name(iKiller,sName,MAX_NAME_LENGTH)
if ((iKiller != iVictim) && (gBonusCount < sizeof gBonusIndex) && (get_user_team(iKiller) != get_user_team(iVictim))) {
gBonusCount++
set_user_money(iKiller,get_user_money(iKiller)+gBonusIndex[gBonusCount-1])
if (gBonusCount == 1) {
format(sMsg,MAX_TEXT_LENGTH,"%s 第1个杀人! (奖励$%i 美元)",sName,gBonusIndex[gBonusCount-1])
//client_print(0,print_chat,"%s 第1个杀人!获得$%i奖励",sName,gBonusIndex[gBonusCount-1])
format(_tmpStr, 255, "%s 第1个杀人!获得$%i奖励",sName,gBonusIndex[gBonusCount-1])
_showChatGreenMsg(iKiller, _tmpStr)
}
else if (gBonusCount == 2) {
format(sMsg,MAX_TEXT_LENGTH,"%s 第2个杀人! (奖励$%i 美元)",sName,gBonusIndex[gBonusCount-1])
//client_print(0,print_chat,"%s 第2个杀人!获得$%i奖励",sName,gBonusIndex[gBonusCount-1])
format(_tmpStr, 255, "%s 第2个杀人!获得$%i奖励",sName,gBonusIndex[gBonusCount-1])
_showChatGreenMsg(iKiller, _tmpStr)
}
else if (gBonusCount == 3) {
format(sMsg,MAX_TEXT_LENGTH,"%s 第3个杀人! (奖励$%i 美元)",sName,gBonusIndex[gBonusCount-1])
//client_print(0,print_chat,"%s 第3个杀人!获得$%i奖励",sName,gBonusIndex[gBonusCount-1])
format(_tmpStr, 255, "%s 第3个杀人!获得$%i奖励",sName,gBonusIndex[gBonusCount-1])
_showChatGreenMsg(iKiller, _tmpStr)
}
else {
format(sMsg,MAX_TEXT_LENGTH,"%s 第%i个杀人! (奖励$%i 美元)",sName,gBonusCount,gBonusIndex[gBonusCount-1])
//client_print(0,print_chat,"%s 第%i个杀人!获得$%i奖励",sName,gBonusCount,gBonusIndex[gBonusCount-1])
format(_tmpStr, 255, "%s 第%i个杀人!获得$%i奖励",sName,gBonusCount,gBonusIndex[gBonusCount-1])
_showChatGreenMsg(iKiller, _tmpStr)
}
display_msg(sMsg,200,200,200)
}
}
return PLUGIN_CONTINUE
}
public event_round_end() {
gRoundStart = false //增加行
gBonusCount = 0
}
public round_start() { //增加行
gRoundStart = true //增加行
} //增加行
public display_msg(msg[],r,g,b)
{
//set_hudmessage(r,g,b,-1.0,0.40,0,6.0,6.0,0.5,0.15,2)
set_hudmessage(random_num(0,255),random_num(0,255),random_num(0,255),-1.0,0.80,2,0.3,6.0,0.03,2.0,153)
show_hudmessage(0,msg)
}
// 显示(Green)颜色的聊天信息
public _showChatGreenMsg(id, msg[256]) {
format(msg, 255, "^x01^x04%s^x01", msg)
new g_msgSayText = get_user_msgid("SayText")
message_begin(MSG_ONE,g_msgSayText, {0,0,0}, id)
write_byte(id)
write_string(msg)
message_end()
}
/************************************************************
* PLUGIN FUNCTIONS
************************************************************/
public plugin_init()
{
register_plugin("Plugin Money Bonus","1.0","DreamZSW")
register_event("DeathMsg","event_death","a")
register_event("SendAudio","event_round_end","a","2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
register_event("HLTV", "round_start", "a", "1=0", "2=0") //增加行
register_concmd("money_bonus","admin_bonuskill",ACCESS_LEVEL,"amx_powers < authid | part of nick >")
}
[/php]
而且这个插件有BUG,按照高手的指点这样做了,还是不行,不知道是不是我的问题
就是修改了以后第一局才起作用,以后的就没起作用了!
谢谢帮忙修改! |
|