jazzxute 发表于 2008-11-14 11:39:47

求助版主修改下,实在搞不懂了!

请版主帮我看下代码哪里不对,编译时提示id msg出错
源码如下:
/*
*   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 = { 5000,4000,3000,2000,1000 }
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
   read_argv(1,sArg1,MAX_NAME_LENGTH)
   if (str_to_num(sArg1)) {
      gBonusMode = 1
      client_print(id,print_chat,"前五名杀人奖励插件已启用.")
   }
   else {
      gBonusMode = 0
      client_print(id,print_chat,"前五名杀人奖励插件已关闭.")
   }
   
   return PLUGIN_HANDLED
}
public event_death()
{
   if (gBonusMode && gRoundStart) { // 修改
      new iKiller = read_data(1)
      new iVictim = read_data(2)
      new sMsg
      new sName
      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)
         if (gBonusCount == 1) {
            format(sMsg,MAX_TEXT_LENGTH,"^x03%s ^x01第1个杀人! (奖励$^x04%i ^x01美元)",sName,gBonusIndex)
            client_color(0,id,msg)
   }
         else if (gBonusCount == 2) {
            format(sMsg,MAX_TEXT_LENGTH,"^x03%s ^x01第2个杀人! (奖励$^x04%i ^x01美元)",sName,gBonusIndex)
            client_color(0,id,msg)
          }
         else if (gBonusCount == 3) {
            format(sMsg,MAX_TEXT_LENGTH,"^x03%s ^x01第3个杀人! (奖励$^x04%i ^x01美元)",sName,gBonusIndex)
            client_color(0,id,msg)
          }
         else {
            format(sMsg,MAX_TEXT_LENGTH,"^x03%s ^x01第%i个杀人! (奖励$^x04%i ^x01美元)",sName,gBonusCount,gBonusIndex)
            client_color(0,id,msg)
          }
         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)
}
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()
}

/************************************************************
* 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 >")
}

Rulzy 发表于 2008-11-14 22:26:52

回复: 求助版主修改下,实在搞不懂了!

#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 = { 5000,4000,3000,2000,1000 }
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
read_argv(1,sArg1,MAX_NAME_LENGTH)
if (str_to_num(sArg1)) {
gBonusMode = 1
client_print(id,print_chat,"前五名杀人奖励插件已启用.")
}
else {
gBonusMode = 0
client_print(id,print_chat,"前五名杀人奖励插件已关闭.")
}

return PLUGIN_HANDLED
}
public event_death()
{
if (gBonusMode && gRoundStart) { // 修改
new iKiller = read_data(1)
new iVictim = read_data(2)
new sMsg
new sName
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)
   format(sMsg,MAX_TEXT_LENGTH,"^x03%s ^x01第%i个杀人! (奖励$^x04%i ^x01美元)",sName,gBonusCount,gBonusIndex)
   client_color(0,iKiller,sMsg)
   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)
}
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()
}
/************************************************************
* 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 >")
}

jazzxute 发表于 2008-11-15 08:31:43

回复: 求助版主修改下,实在搞不懂了!

版主真是好人啊。谢谢收了

zlove84 发表于 2008-11-15 19:38:49

回复: 求助版主修改下,实在搞不懂了!

求:Rulzy能不能在teamtalk的基础上加功能!
http://www.dt-club.net/forum/showthread.php?p=322602#post322602
页: [1]
查看完整版本: 求助版主修改下,实在搞不懂了!