Raised This Month: $ Target: $400
 0% 

Plugin writes huge errorlog.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hammerfallerz
Senior Member
Join Date: Feb 2008
Old 11-06-2009 , 09:52   Plugin writes huge errorlog.
Reply With Quote #1

Ok, so some time I took this plugin:
http://forums.alliedmods.net/showthread.php?p=541795 (Admin Grab +).

Since we're running zombie plague server, I had to get rid of that glow, because it somehow resets player model, e.g. after this zombie is running with T skin etc.

So I've made a code to look like this:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

new const VERSION[ ] = "1.2.3"
new const TRKCVAR[ ] = "grab_plus_version"
#define ADMIN ADMIN_BAN

#define TSK_CHKE 50

#define SF_FADEOUT 0

new client_data[33][4]
#define GRABBED  0
#define GRABBER  1
#define GRAB_LEN 2
#define FLAGS    3

#define CDF_IN_PUSH   (1<<0)
#define CDF_IN_PULL   (1<<1)
#define CDF_NO_CHOKE  (1<<2)

//Cvar Pointers
new p_enabledp_players_only
new p_throw_forcep_min_distp_speedp_grab_force
new p_choke_timep_choke_dmgp_auto_choke
// new p_glow_r, p_glow_b, p_glow_g, p_glow_a
// new p_fade, p_glow

//Pseudo Constants
new MAXPLAYERS
// new SVC_SCREENFADE, SVC_SCREENSHAKE, WTF_DAMAGE

public plugin_init( )
{
    
register_plugin"Grab+"VERSION"Ian Cammarata" )
    
register_cvarTRKCVARVERSIONFCVAR_SERVER )
    
set_cvar_stringTRKCVARVERSION )
    
    
p_enabled register_cvar"gp_enabled""1" )
    
p_players_only register_cvar"gp_players_only""0" )
    
    
p_min_dist register_cvar "gp_min_dist""90" )
    
p_throw_force register_cvar"gp_throw_force""1500" )
    
p_grab_force register_cvar"gp_grab_force""8" )
    
p_speed register_cvar"gp_speed""5" )
    
    
p_choke_time register_cvar"gp_choke_time""1.5" )
    
p_choke_dmg register_cvar"gp_choke_dmg""5" )
    
p_auto_choke register_cvar"gp_auto_choke""1" )
    
/*
    p_glow_r = register_cvar( "gp_glow_r", "50" )
    p_glow_g = register_cvar( "gp_glow_g", "0" )
    p_glow_b = register_cvar( "gp_glow_b", "0" )
    p_glow_a = register_cvar( "gp_glow_a", "200" )
    
    p_fade = register_cvar( "gp_screen_fade", "1" )
    p_glow = register_cvar( "gp_glow", "0" )
*/
    
    
register_clcmd"amx_grab""force_grab"ADMIN"Grab client & teleport to you." )
    
register_clcmd"grab_toggle""grab_toggle"ADMIN"press once to grab and again to release" )
    
register_clcmd"+grab""grab"ADMIN"bind a key to +grab" )
    
register_clcmd"-grab""unset_grabbed" )
    
    
register_clcmd"+push""push"ADMIN"bind a key to +push" )
    
register_clcmd"-push""push" )
    
register_clcmd"+pull""pull"ADMIN"bind a key to +pull" )
    
register_clcmd"-pull""pull" )
    
register_clcmd"push""push2" )
    
register_clcmd"pull""pull2" )
    
    
register_clcmd"drop" ,"throw" )
    
    
register_event"DeathMsg""DeathMsg""a" )
    
    
register_forwardFM_PlayerPreThink"fm_player_prethink" )
    
    
register_dictionary"grab_plus.txt" )
    
    
MAXPLAYERS get_maxplayers()

    
/*
    SVC_SCREENFADE = get_user_msgid( "ScreenFade" )
    SVC_SCREENSHAKE = get_user_msgid( "ScreenShake" )
    WTF_DAMAGE = get_user_msgid( "Damage" )
    */
}

public 
plugin_precache( )
{
    
precache_sound"player/PL_PAIN2.WAV" )


public 
fm_player_prethinkid )
{
    new 
target
    
//Search for a target
    
if ( client_data[id][GRABBED] == -)
    {
        new 
Float:orig[3], Float:ret[3]
        
get_view_posidorig )
        
ret vel_by_aimid9999 )
        
        
ret[0] += orig[0]
        
ret[1] += orig[1]
        
ret[2] += orig[2]
        
        
target tracelineorigretidret )
        
        if( 
target <= MAXPLAYERS )
        {
            if( 
is_grabbedtargetid ) ) return FMRES_IGNORED
            set_grabbed
idtarget )
        }
        else if( !
get_pcvar_nump_players_only ) )
        {
            new 
movetype
            
if( target && pev_validtarget ) )
            {
                
movetype pevtargetpev_movetype )
                if( !( 
movetype == MOVETYPE_WALK || movetype == MOVETYPE_STEP || movetype == MOVETYPE_TOSS ) )
                    return 
FMRES_IGNORED
            
}
            else
            {
                
target 0
                
new ent engfuncEngFunc_FindEntityInSphere, -1ret12.0 )
                while( !
target && ent )
                {
                    
movetype peventpev_movetype )
                    if( ( 
movetype == MOVETYPE_WALK || movetype == MOVETYPE_STEP || movetype == MOVETYPE_TOSS )
                            && 
ent != id  )
                        
target ent
                    ent 
engfuncEngFunc_FindEntityInSphereentret12.0 )
                }
            }
            if( 
target )
            {
                if( 
is_grabbedtargetid ) ) return FMRES_IGNORED
                set_grabbed
idtarget )
            }
        }
    }
    
    
target client_data[id][GRABBED]
    
//If they've grabbed something
    
if( target )
    {
        if( !
pev_validtarget ) || ( pevtargetpev_health ) < && pevtargetpev_max_health ) ) )
        {
            
unset_grabbedid )
            return 
FMRES_IGNORED
        
}
         
        
//Use key choke
        
if( pevidpev_button ) & IN_USE )
            
do_chokeid )
        
        
//Push and pull
        
new cdf client_data[id][FLAGS]
        if ( 
cdf CDF_IN_PULL )
            
do_pullid )
        else if ( 
cdf CDF_IN_PUSH )
            
do_pushid )
        
        if( 
target MAXPLAYERS grab_thinkid )
    }
    
    
//If they're grabbed
    
target client_data[id][GRABBER]
    if( 
target grab_thinktarget )
    
    return 
FMRES_IGNORED
}

public 
grab_thinkid //id of the grabber
{
    new 
target client_data[id][GRABBED]
    
    
//Keep grabbed clients from sticking to ladders
    
if( pevtargetpev_movetype ) == MOVETYPE_FLY && !(pevtargetpev_button ) & IN_JUMP ) ) client_cmdtarget"+jump;wait;-jump" )
    
    
//Move targeted client
    
new Float:tmpvec[3], Float:tmpvec2[3], Float:torig[3], Float:tvel[3]
    
    
get_view_posidtmpvec )
    
    
tmpvec2 vel_by_aimidclient_data[id][GRAB_LEN] )
    
    
torig get_target_origin_ftarget )
    
    new 
force get_pcvar_nump_grab_force )
    
    
tvel[0] = ( ( tmpvec[0] + tmpvec2[0] ) - torig[0] ) * force
    tvel
[1] = ( ( tmpvec[1] + tmpvec2[1] ) - torig[1] ) * force
    tvel
[2] = ( ( tmpvec[2] + tmpvec2[2] ) - torig[2] ) * force
    
    set_pev
targetpev_velocitytvel )
}

stock Float:get_target_origin_fid )
{
    new 
Float:orig[3]
    
pevidpev_originorig )
    
    
//If grabbed is not a player, move origin to center
    
if( id MAXPLAYERS )
    {
        new 
Float:mins[3], Float:maxs[3]
        
pevidpev_minsmins )
        
pevidpev_maxsmaxs )
        
        if( !
mins[2] ) orig[2] += maxs[2] / 2
    
}
    
    return 
orig
}

public 
grab_toggleidlevelcid )
{
    if( !
client_data[id][GRABBED] ) grabidlevelcid )
    else 
unset_grabbedid )
    
    return 
PLUGIN_HANDLED
}

public 
grabidlevelcid )
{
    if( !
cmd_accessidlevelcid) || !get_pcvar_nump_enabled ) ) return PLUGIN_HANDLED
    
    
if ( !client_data[id][GRABBED] ) client_data[id][GRABBED] = -1    
    
    
return PLUGIN_HANDLED
}

public throw( 
id )
{
    new 
target client_data[id][GRABBED]
    if( 
target )
    {
        
set_pevtargetpev_velocityvel_by_aimidget_pcvar_num(p_throw_force) ) )
        
unset_grabbedid )
        return 
PLUGIN_HANDLED
    
}

    return 
PLUGIN_CONTINUE
}

public 
unset_grabbedid )
{
    new 
target client_data[id][GRABBED]
    if( 
target && pev_validtarget ) )
    
client_data[id][GRABBED] = 0
}

//Grabs onto someone
public set_grabbedidtarget )
{    
    if( 
target <= MAXPLAYERS )
        
client_data[target][GRABBER] = id
    client_data
[id][FLAGS] = 0
    client_data
[id][GRABBED] = target
    
new Float:torig[3], Float:orig[3]
    
pevtargetpev_origintorig )
    
pevidpev_originorig )
    
client_data[id][GRAB_LEN] = floatroundget_distance_ftorigorig ) )
    if( 
client_data[id][GRAB_LEN] < get_pcvar_nump_min_dist ) ) client_data[id][GRAB_LEN] = get_pcvar_nump_min_dist )
}

public 
pushid )
{
    
client_data[id][FLAGS] ^= CDF_IN_PUSH
    
return PLUGIN_HANDLED
}

public 
pullid )
{
    
client_data[id][FLAGS] ^= CDF_IN_PULL
    
return PLUGIN_HANDLED
}

public 
push2id )
{
    if( 
client_data[id][GRABBED] > )
    {
        
do_pushid )
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
pull2id )
{
    if( 
client_data[id][GRABBED] > )
    {
        
do_pullid )
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
do_pushid )
    if( 
client_data[id][GRAB_LEN] < 9999 )
        
client_data[id][GRAB_LEN] += get_pcvar_nump_speed )

public 
do_pullid )
{
    new 
mindist get_pcvar_nump_min_dist )
    new 
len client_data[id][GRAB_LEN]
    
    if( 
len mindist )
    {
        
len -= get_pcvar_nump_speed )
        if( 
len mindist len mindist
        client_data
[id][GRAB_LEN] = len
    
}
    else if( 
get_pcvar_nump_auto_choke ) )
        
do_chokeid )
}

public 
do_chokeid )
{
    new 
target client_data[id][GRABBED]
    if( 
client_data[id][FLAGS] & CDF_NO_CHOKE || id == target || target MAXPLAYERS) return
    
    new 
dmg get_pcvar_nump_choke_dmg )
    new 
vec[3]
    
FVecIVecget_target_origin_ftarget ), vec )
            
    
message_beginMSG_BROADCASTSVC_TEMPENTITY )
    
write_byteTE_BLOODSTREAM )
    
write_coordvec[0] ) //pos.x
    
write_coordvec[1] ) //pos.y
    
write_coordvec[2] + 15 //pos.z
    
write_coordrandom_num0255 ) ) //vec.x
    
write_coordrandom_num0255 ) ) //vec.y
    
write_coordrandom_num0255 ) ) //vec.z
    
write_byte70 //col index
    
write_byterandom_num50250 ) ) //speed
    
message_end( )
    
    new 
health pevtargetpev_health ) - dmg
    set_pev
targetpev_healthfloathealth ) )
    if( 
health dllfuncDLLFunc_ClientKilltarget )
    
    
emit_soundtargetCHAN_BODY"player/PL_PAIN2.WAV"VOL_NORMATTN_NORM0PITCH_NORM )
    
    
client_data[id][FLAGS] ^= CDF_NO_CHOKE
    set_task
get_pcvar_floatp_choke_time ), "clear_no_choke"TSK_CHKE id )
}

public 
clear_no_choketskid )
{
    new 
id tskid TSK_CHKE
    client_data
[id][FLAGS] ^= CDF_NO_CHOKE
}

//Grabs the client and teleports them to the admin
public force_grab(idlevelcid)
{
    if( !
cmd_accessidlevelcid) || !get_pcvar_nump_enabled ) ) return PLUGIN_HANDLED

    
new arg[33]
    
read_argv1arg32 )

    new 
targetid cmd_targetidarg)
    
    if( 
is_grabbedtargetidid ) ) return PLUGIN_HANDLED
    
if( !is_user_alivetargetid ) )
    {
        
client_printidprint_console"[AMXX] %L"id"COULDNT" )
        return 
PLUGIN_HANDLED
    
}
    
    
//Safe to tp target to aim spot?
    
new Float:tmpvec[3], Float:orig[3], Float:torig[3], Float:trace_ret[3]
    new 
bool:safe falsei
    
    get_view_pos
idorig )
    
tmpvec vel_by_aimidget_pcvar_nump_min_dist ) )
    
    for( new 
111 && !safej++ )
    {
        
torig[0] = orig[0] + tmpvec[i] * j
        torig
[1] = orig[1] + tmpvec[i] * j
        torig
[2] = orig[2] + tmpvec[i] * j
        
        traceline
tmpvectorigidtrace_ret )
        
        if( 
get_distance_ftrace_rettorig ) ) break
        
        
engfuncEngFunc_TraceHulltorigtorig0HULL_HUMAN0)
        if ( !
get_tr20TR_StartSolid ) && !get_tr20TR_AllSolid ) && get_tr20TR_InOpen ) )
            
safe true
    
}
    
    
//Still not safe? Then find another safe spot somewhere around the grabber
    
pevidpev_originorig )
    new try[
3]
    
orig[2] += 2
    
while( try[2] < && !safe )
    {
        for( 
03i++ )
            switch( try[
i] )
            {
                case 
torig[i] = orig[i] + ( == 80 40 )
                case 
torig[i] = orig[i]
                case 
torig[i] = orig[i] - ( == 80 40 )
            }
        
        
tracelinetmpvectorigidtrace_ret )
        
        
engfuncEngFunc_TraceHulltorigtorig0HULL_HUMAN0)
        if ( !
get_tr20TR_StartSolid ) && !get_tr20TR_AllSolid ) && get_tr20TR_InOpen )
                && !
get_distance_ftrace_rettorig ) ) safe true
        
        
try[0]++
        if( try[
0] == )
        {
            try[
0] = 0
            
try[1]++
            if( try[
1] == )
            {
                try[
1] = 0
                
try[2]++
            }
        }
    }
    
    if( 
safe )
    {
        
set_pevtargetidpev_origintorig )
        
set_grabbedidtargetid )
    }
    else 
client_printidprint_chat"[AMXX] %L"id"COULDNT" )

    return 
PLUGIN_HANDLED
}

public 
is_grabbedtargetgrabber )
{
    for( new 
1<= MAXPLAYERSi++ )
        if( 
client_data[i][GRABBED] == target )
        {
            
client_printgrabberprint_chat"[AMXX] %L"grabber"ALREADY" )
            
unset_grabbedgrabber )
            return 
true
        
}
    return 
false
}

public 
DeathMsg( )
    
kill_grabread_data) )

public 
client_disconnectid )
{
    
kill_grabid )
    return 
PLUGIN_CONTINUE
}

public 
kill_grabid )
{
    
//If given client has grabbed, or has a grabber, unset it
    
if( client_data[id][GRABBED] )
        
unset_grabbedid )
    else if( 
client_data[id][GRABBER] )
        
unset_grabbedclient_data[id][GRABBER] )
}

stock traceline( const Float:vStart[3], const Float:vEnd[3], const pIgnoreFloat:vHitPos[3] )
{
    
engfuncEngFunc_TraceLinevStartvEnd0pIgnore)
    
get_tr20TR_vecEndPosvHitPos )
    return 
get_tr20TR_pHit )
}

stock get_view_pos( const idFloat:vViewPos[3] )
{
    new 
Float:vOfs[3]
    
pevidpev_originvViewPos )
    
pevidpev_view_ofsvOfs )        
    
    
vViewPos[0] += vOfs[0]
    
vViewPos[1] += vOfs[1]
    
vViewPos[2] += vOfs[2]
}

stock Float:vel_by_aimidspeed )
{
    new 
Float:v1[3], Float:vBlah[3]
    
pevidpev_v_anglev1 )
    
engfuncEngFunc_AngleVectorsv1v1vBlahvBlah )
    
    
v1[0] *= speed
    v1
[1] *= speed
    v1
[2] *= speed
    
    
return v1

It works and everything seems to be fine, no model is reset etc, however, I can see a huge spam in errorlog:

Quote:
L 11/06/2009 - 169:16: [AMXX] Displaying debug trace (plugin "grab_plus.amxx")
L 11/06/2009 - 169:16: [AMXX] Run time error 10: native error (native "pev")
L 11/06/2009 - 169:16: [AMXX] [0] grab_plus.sma::grab_think (line 183)
L 11/06/2009 - 169:16: [AMXX] [1] grab_plus.sma::fm_player_prethink (line 173)
L 11/06/2009 - 169:16: [FAKEMETA] Invalid entity
Can anyone please help me with this? Every day each errorlog takes ~50 mb on a HDD.
Hammerfallerz is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 11-06-2009 , 10:48   Re: Plugin writes huge errorlog.
Reply With Quote #2

Go to line 173, and replace line
Code:
if( target > 0 ) grab_think( target ) // -> if( pev_valid( target ) ) grab_think( target )
__________________
xPaw is offline
Hammerfallerz
Senior Member
Join Date: Feb 2008
Old 11-06-2009 , 11:11   Re: Plugin writes huge errorlog.
Reply With Quote #3

Thanks, I'll test it
Hammerfallerz is offline
Hammerfallerz
Senior Member
Join Date: Feb 2008
Old 11-08-2009 , 17:47   Re: Plugin writes huge errorlog.
Reply With Quote #4

Changed, but still:
Quote:
L 11/08/2009 - 22:50:21: [FAKEMETA] Invalid entity
L 11/08/2009 - 22:50:21: [AMXX] Displaying debug trace (plugin "grab_plus.amxx")
L 11/08/2009 - 22:50:21: [AMXX] Run time error 10: native error (native "pev")
L 11/08/2009 - 22:50:21: [AMXX] [0] grab_plus.sma::grab_think (line 183)
L 11/08/2009 - 22:50:21: [AMXX] [1] grab_plus.sma::fm_player_prethink (line 173)
Hammerfallerz is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-08-2009 , 17:49   Re: Plugin writes huge errorlog.
Reply With Quote #5

Post in the plugin thread, will be better if someone has the same error as you, or if the author receive emails when someone posts in that thread.

http://forums.alliedmods.net/showthread.php?p=541795
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Hammerfallerz
Senior Member
Join Date: Feb 2008
Old 11-08-2009 , 17:52   Re: Plugin writes huge errorlog.
Reply With Quote #6

Authors Last Activity: 07-13-08

I highly doubt it's still supported by him, but plugin is great, so I'm asking for help here.
Hammerfallerz is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-09-2009 , 06:26   Re: Plugin writes huge errorlog.
Reply With Quote #7

Doesn't mean you can't get support on that thread.
Better that all users who have problems with that plugin post on the same thread.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:47.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode