搜索
查看: 2085|回复: 3

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

[复制链接]
发表于 2008-11-14 11:39:47 | 显示全部楼层 |阅读模式 来自 中国–浙江–宁波–慈溪市
请版主帮我看下代码哪里不对,编译时提示id msg出错
源码如下:
[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] = { 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[MAX_NAME_LENGTH]
   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[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,"^x03%s ^x01第1个杀人! (奖励$^x04%i ^x01美元)",sName,gBonusIndex[gBonusCount-1])
            client_color(0,id,msg)
   }
         else if (gBonusCount == 2) {
            format(sMsg,MAX_TEXT_LENGTH,"^x03%s ^x01第2个杀人! (奖励$^x04%i ^x01美元)",sName,gBonusIndex[gBonusCount-1])
            client_color(0,id,msg)
          }
         else if (gBonusCount == 3) {
            format(sMsg,MAX_TEXT_LENGTH,"^x03%s ^x01第3个杀人! (奖励$^x04%i ^x01美元)",sName,gBonusIndex[gBonusCount-1])
            client_color(0,id,msg)
          }
         else {
            format(sMsg,MAX_TEXT_LENGTH,"^x03%s ^x01第%i个杀人! (奖励$^x04%i ^x01美元)",sName,gBonusCount,gBonusIndex[gBonusCount-1])
            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 >")
}
[/PHP]
发表于 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[5] = { 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[MAX_NAME_LENGTH]
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[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])
   format(sMsg,MAX_TEXT_LENGTH,"^x03%s ^x01第%i个杀人! (奖励$^x04%i ^x01美元)",sName,gBonusCount,gBonusIndex[gBonusCount-1])
   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 >")
}
回复

使用道具 举报

 楼主| 发表于 2008-11-15 08:31:43 | 显示全部楼层 来自 中国–浙江–宁波–慈溪市

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

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

使用道具 举报

发表于 2008-11-15 19:38:49 | 显示全部楼层 来自 中国–广东–佛山–南海区

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

求:Rulzy能不能在teamtalk的基础上加功能!
http://www.dt-club.net/forum/showthread.php?p=322602#post322602
回复

使用道具 举报

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

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