wwww23 发表于 2008-8-12 23:48:20

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

手雷砸人掉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, ptdname, ptrModel
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, origin
entity_get_vector(grenadeid, EV_VEC_origin, gorigin)
origin=floatround(gorigin)
origin=floatround(gorigin)
origin=floatround(gorigin)
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) // damageOrigin.x
write_coord(origin) // damageOrigin.y
write_coord(origin) // damageOrigin.z
message_end()
}
L 08/12/2008 - 23:44:59: Invalid message id
L 08/12/2008 - 23:44:59: Run time error 10 (plugin "grenades_are_heavy.amxx") (native "set_msg_block") - debug not enabled!
L 08/12/2008 - 23:44:59: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:10: Invalid entity 254
L 08/12/2008 - 23:45:10: Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:10: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:16: Invalid entity 238
L 08/12/2008 - 23:45:16: Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:16: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:16: Invalid entity 236
L 08/12/2008 - 23:45:16: Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:16: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:20: Invalid entity 256
L 08/12/2008 - 23:45:20: Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:20: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:22: Invalid entity 235
L 08/12/2008 - 23:45:22: Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:22: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:22: Invalid entity 238
L 08/12/2008 - 23:45:22: Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:22: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:23: Invalid entity 263
L 08/12/2008 - 23:45:23: Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:23: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:23: Invalid entity 256
L 08/12/2008 - 23:45:23: Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:23: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:34: Invalid entity 249
L 08/12/2008 - 23:45:34: Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:34: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:39: Invalid entity 240
L 08/12/2008 - 23:45:39: Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:39: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:39: Invalid entity 238
L 08/12/2008 - 23:45:39: Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:39: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 08/12/2008 - 23:45:39: Invalid entity 244
L 08/12/2008 - 23:45:39: Run time error 10 (plugin "grenades_are_heavy.amxx") (native "entity_get_string") - debug not enabled!
L 08/12/2008 - 23:45:39: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
请问这到底是什么原因?出错实在太多了。十分感谢。

yzmzx 发表于 2008-8-15 23:26:41

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

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

Cr@zyTreE 发表于 2008-8-15 23:41:14

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

你都不开debug,哪里看的出问题在哪里?
页: [1]
查看完整版本: 代码总出错,日志达到2MB受不了了。