搜索
查看: 2705|回复: 2

代码总出错,日志达到2MB受不了了。

[复制链接]
发表于 2008-8-12 23:48:20 | 显示全部楼层 |阅读模式 来自 中国–广西–柳州–柳北区
手雷砸人掉HP的原码:
/*
#define USING_AMX 0 // 1 = Using AMX \ 0 = Using AMXX
#if USING_AMX
#include <amxmod>
#include <VexdUM>
#else
#include <amxmodx>
#include <engine>
#include <cstrike>
#include <fun>
#endif

new gMsgDeathMsg
new gCurrentNade
public plugin_init()
{
// Plugin Info
register_plugin("Grenades Are Heavy", "1.0", "AssKicR")
register_event("RoundTime", "newRound", "bc")
register_cvar("amx_heimpactdmg","6")
register_cvar("amx_fbimpactdmg","6")
register_cvar("amx_sgimpactdmg","6")
register_cvar("amx_obeyff", "1")
gMsgDeathMsg = get_user_msgid("DeathMsg")
}
public newRound() {
new Float:roundtime = get_cvar_float("mp_roundtime") * 60.0
new rtime = read_data(1)
if(roundtime == rtime) {
   gCurrentNade=0
}
}
public pfn_touch(ptr, ptd)
{
if (ptd!=0 && ptr!=0) {
  new ptrname[32], ptdname[32], ptrModel[32]
  entity_get_string(ptr, EV_SZ_classname, ptrname, 31)
  entity_get_string(ptd, EV_SZ_classname, ptdname, 31)
  if(equal(ptrname, "grenade") && equal(ptdname, "player")) {
   if (gCurrentNade==ptr) return
   gCurrentNade=ptr
   new ptrOwner = entity_get_edict(ptr, EV_ENT_owner)
   
   new bool:HitFriend=false
   new ObeyFF = get_cvar_num("amx_obeyff") ? 1:0
   new FFOn = get_cvar_num("mp_friendlyfire") ? 1:0
   if(!FFOn && ObeyFF) {
     if(get_user_team(ptd) == get_user_team(ptrOwner)) {
       HitFriend=true
     }
   }
   if(!HitFriend) {
    entity_get_string(ptr, EV_SZ_model, ptrModel, 31)
    //client_print(0, 3, "Grenade with model ^"%s^" has hit a player",ptrModel) //This is for debugging
    if (equali(ptrModel,"models/w_hegrenade.mdl")) {
    emit_sound(ptr, CHAN_ITEM, "weapons/ric_metal-1.wav", 0.7, ATTN_NORM, 0, PITCH_NORM)
    emit_sound(ptd, CHAN_BODY, "player/bhit_flesh-1.wav", 0.7, ATTN_NORM, 0, PITCH_NORM)
    ImpactDamage(ptd,ptr)
    ScreenShake(ptd,
    14, 14, 14 )
    ScreenFlash(ptd, 255, 0, 0, 1, 200 )
    HazedView(ptd, 120 )
    ExtraDamage(ptd, ptrOwner, get_cvar_num("amx_heimpactdmg"), "grenade" )
    }else if (equali(ptrModel,"models/w_flashbang.mdl")) {
    emit_sound(ptr, CHAN_ITEM, "weapons/ric_metal-1.wav", 0.7, ATTN_NORM, 0, PITCH_NORM)
    emit_sound(ptd, CHAN_BODY, "player/bhit_flesh-1.wav", 0.7, ATTN_NORM, 0, PITCH_NORM)
    ImpactDamage(ptd,ptr)
    ScreenShake(ptd, 14, 14, 14 )
    ScreenFlash(ptd, 255, 0, 0, 1, 200 )
    HazedView(ptd, 120 )
    ExtraDamage(ptd, ptrOwner, get_cvar_num("amx_fbimpactdmg"), "flashbang" )
    }else if (equali(ptrModel,"models/w_smokegrenade.mdl")) {
    emit_sound(ptr, CHAN_ITEM, "weapons/ric_metal-1.wav", 0.7, ATTN_NORM, 0, PITCH_NORM)
    emit_sound(ptd, CHAN_BODY, "player/bhit_flesh-1.wav", 0.7, ATTN_NORM, 0, PITCH_NORM)
    ImpactDamage(ptd,ptr)
    ScreenShake(ptd, 14, 14, 14 )
    ScreenFlash(ptd, 255, 0, 0, 1, 200 )
    HazedView(ptd, 120 )
    ExtraDamage(ptd, ptrOwner, get_cvar_num("amx_sgimpactdmg"), "smokegrenade" )
    }
   }
  }
}
}
public ExtraDamage(id, attacker, damage, weaponDescription[] )
{
if ( is_user_alive(id) )
{
  new userHealth=get_user_health(id)
  set_msg_block(gMsgDeathMsg, BLOCK_SET)
  set_user_health(id, userHealth - damage )
  set_msg_block(gMsgDeathMsg, BLOCK_NOT)
  if ( userHealth - damage <= 0 )
  {
   if ( get_user_team(id) != get_user_team(attacker) )
   {
    // The person dying shouldn't get negative credit for this kill (so add it back)
    set_user_frags( id, get_user_frags(id) + 1 )
      
    // The killing should get credit for the frag
    set_user_frags( attacker, get_user_frags(attacker)+ 1 )
   }
   else
   {
    // The person dying shouldn't get negative credit for this kill (so add it back)
    set_user_frags( id, get_user_frags(id)+ 1 )
      
    // The killer killed a teammember or self
    // Engine gives credit for the kill so let's take away that + 1
    set_user_frags( attacker, get_user_frags(attacker) - 2)
   }
  }
}
}
#if USING_AMX
stock cs_get_user_money(index) return get_user_money(index)
stock cs_set_user_money(index, money, flash = 1) set_user_money(index, money, flash)
#endif

public ScreenShake(id, amplitude, duration, frequency )
{
  if ( !is_user_alive(id) ) return
  message_begin(MSG_ONE, get_user_msgid("ScreenShake"),{0,0,0},id)
  write_short( 1<<amplitude )// amplitude
  write_short( 1<<duration )// duration
  write_short( 1<<frequency )// frequency
  message_end()
}
public ScreenFlash(id, red, green, blue, decisecs, alpha)
{
  if ( !is_user_alive(id) ) return
  message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id)
  write_short( decisecs<<12 ) // fade lasts this long duration
  write_short( 1<<16 ) // fade lasts this long hold time
  write_short( 1<<1 ) // fade type (in / out)
  write_byte( red ) // fade red
  write_byte( green ) // fade green
  write_byte( blue ) // fade blue
  write_byte( alpha ) // fade alpha
  message_end()
}
public HazedView(id, frequency )
{
  if ( !is_user_alive(id) ) return
  message_begin(MSG_ONE, get_user_msgid("SetFOV"), {0,0,0}, id)
  write_byte( frequency ) // FOV Distance
  message_end()
  set_task(2.0,"RestoreVision",id)
}
public RestoreVision(id)
{
  message_begin(MSG_ONE, get_user_msgid("SetFOV"), {0,0,0}, id)
  write_byte( 90 ) // FOV Default
  message_end()
}
public ImpactDamage(id,grenadeid) {
  new Float:gorigin[3], origin[3]
  entity_get_vector(grenadeid, EV_VEC_origin, gorigin)
  origin[0]=floatround(gorigin[0])
  origin[1]=floatround(gorigin[1])
  origin[2]=floatround(gorigin[2])
  if ( !is_user_alive(id) ) return
  message_begin(MSG_ONE, get_user_msgid("Damage"), {0,0,0}, id)
  write_byte(30) // dmg_save
  write_byte(30) // dmg_take
  write_long(0) // visibleDamageBits
  write_coord(origin[0]) // damageOrigin.x
  write_coord(origin[1]) // damageOrigin.y
  write_coord(origin[2]) // damageOrigin.z
  message_end()
}
L 08/12/2008 - 23:44:59: Invalid message id
L 08/12/2008 - 23:44:59: [AMXX] Run time error 10 (plugin "grenades_are_heavy.amxx") (native "set_msg_block") - debug not enabled!
L 08/12/2008 - 23:44:59: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:10: [ENGINE] Invalid entity 254
L 08/12/2008 - 23:45:10: [AMXX] Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:10: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:16: [ENGINE] Invalid entity 238
L 08/12/2008 - 23:45:16: [AMXX] Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:16: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:16: [ENGINE] Invalid entity 236
L 08/12/2008 - 23:45:16: [AMXX] Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:16: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:20: [ENGINE] Invalid entity 256
L 08/12/2008 - 23:45:20: [AMXX] Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:20: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:22: [ENGINE] Invalid entity 235
L 08/12/2008 - 23:45:22: [AMXX] Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:22: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:22: [ENGINE] Invalid entity 238
L 08/12/2008 - 23:45:22: [AMXX] Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:22: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:23: [ENGINE] Invalid entity 263
L 08/12/2008 - 23:45:23: [AMXX] Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:23: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:23: [ENGINE] Invalid entity 256
L 08/12/2008 - 23:45:23: [AMXX] Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:23: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:34: [ENGINE] Invalid entity 249
L 08/12/2008 - 23:45:34: [AMXX] Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:34: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:39: [ENGINE] Invalid entity 240
L 08/12/2008 - 23:45:39: [AMXX] Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:39: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:39: [ENGINE] Invalid entity 238
L 08/12/2008 - 23:45:39: [AMXX] Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:39: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:39: [ENGINE] Invalid entity 244
L 08/12/2008 - 23:45:39: [AMXX] Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:39: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
请问这到底是什么原因?出错实在太多了。十分感谢。
发表于 2008-8-15 23:26:41 | 显示全部楼层 来自 中国–广东–东莞

回复: 代码总出错,日志达到2MB受不了了。

不要用这个插件,没多大意思....
回复

使用道具 举报

发表于 2008-8-15 23:41:14 | 显示全部楼层 来自 中国–广东–深圳

回复: 代码总出错,日志达到2MB受不了了。

你都不开debug,哪里看的出问题在哪里?
回复

使用道具 举报

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

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