et007 发表于 2006-9-10 18:21:08

请帮我看看哪里出错

插件quake_like.amxx在amxx1,71下可以正常编译和加载,但总提示要加载debug,加入debug后显示
L 09/10/2006 - 16:14:08: Displaying debug trace (plugin "quake_like.amxx")
L 09/10/2006 - 16:14:08: Run time error 10: native error (native "client_cmd")
L 09/10/2006 - 16:14:08:     quake_like.sma::makeDamage (line 64)

我把插件源码帖上来,请看看是哪里出错?谢谢!

#include <amxmodx>

readSettings( ) {
   new flags
   get_cvar_string( "amx_q3_mode" , flags ,11)
   return read_flags( flags )
}

public client_putinserver(id) {
   if ( readSettings( ) & 8 ) {
      new param
      param = id
      set_task ( 2.0 , "enterMsg" , 0 , param , 1)
   }
   return PLUGIN_CONTINUE
}

public enterMsg (param[])
client_cmd( param , "spk q3/en" )

public client_disconnect(id) {
if ( readSettings( ) & 16)
      client_cmd(0,"spk q3/le")
return PLUGIN_CONTINUE
}

public newRound ( ) {
   new roundtime = floatround( get_cvar_float("mp_roundtime") * 60.0 )
   if ( roundtime == read_data(1) && readSettings( ) & 4 )   
      client_cmd(0,"spk q3/pr")
   return PLUGIN_CONTINUE
}

public makeDamage( victim ) {
   new wpn, hitzone,attacker = get_user_attacker(victim,wpn,hitzone)
   if ( !attacker ) return
   new teamA = get_user_team ( attacker )
   new teamV = get_user_team ( victim )
   if ( teamV == teamA ) {
      if ( readSettings( ) & 2 )
          client_cmd(attacker,"spk q3/1")
   }
   else if ( readSettings( ) & 1 )
      client_cmd(attacker,"spk q3/2")
}

public plugin_precache() {
   precache_sound( "q3/1.wav" )
   precache_sound( "q3/2.wav" )
   precache_sound( "q3/pr.wav" )
   precache_sound( "q3/en.wav" )
   precache_sound( "q3/le.wav" )
   return PLUGIN_CONTINUE
}

public plugin_init() {
   register_plugin ("Quake like","1.2","DanRaZor")
   register_event("Damage"      ,"makeDamage" ,"b","2!0","3=0","4!0")
   register_event("RoundTime"   ,"newRound"   ,"bc")
   register_cvar   ("amx_q3_mode" ,"abcde" )
   return PLUGIN_CONTINUE
}

et007 发表于 2006-9-10 18:24:44

回复: 请帮我看看哪里出错

另一个插件HLMP_CHT.amxx,加入debug后也有大量的提示
L 09/10/2006 - 16:14:19: Displaying debug trace (plugin "HLMP_CHT.amxx")
L 09/10/2006 - 16:14:19: Run time error 4: index out of bounds
L 09/10/2006 - 16:14:19:     HLMP_CHT.sma::EventSuicide (line 123)
L 09/10/2006 - 16:15:05: Invalid player id 3569
L 09/10/2006 - 16:15:05: Displaying debug trace (plugin "HLMP_CHT.amxx")
L 09/10/2006 - 16:15:05: Run time error 10: native error (native "client_cmd")
L 09/10/2006 - 16:15:05:     HLMP_CHT.sma::EventJoinTeam (line 135)
请告诉我到底哪里出错?

pop781 发表于 2006-9-11 19:39:48

回复: 请帮我看看哪里出错

看上去基本没问题
public makeDamage( victim )

要用这个返回值
return PLUGIN_CONTINUE

hqzycs 发表于 2006-9-12 13:17:01

回复: 请帮我看看哪里出错

*)#&_!*&*^#!&^#$!&#$^!^@#!$
页: [1]
查看完整版本: 请帮我看看哪里出错