PDA

View Full Version : Plugin event HOOKdeathmessage error


AngeIII
06-29-2010, 16:18
I'm trying to edit plugin Hns Shop to Deathrun Shop [$ without points]

work perfectly, but also I see in error_log this message:


L 08/27/2009 - 23:10:44: [AMXX] Displaying debug trace (plugin "Deathrun_Shop.amxx")
L 08/27/2009 - 23:10:44: [AMXX] Run time error 4: index out of bounds
L 08/27/2009 - 23:10:44: [AMXX] [0] 41590.attach::Hook_Deathmessage (line 449)
don't see [line] because I removed any comments..

bus I think this event doesn't work perfectly in deathrun mod :F [trigger_hurt kill and worldspawn..]


//// DR_Shop.sma
// Header size: 2476 bytes
// Code size: 29812 bytes
// Data size: 13720 bytes
// Stack/heap size: 16384 bytes; estimated max. usage=781 cells (3124 bytes
)
// Total requirements: 62392 bytes
// Done.
//
// Compilation Time: 0,7 sec
// ----------------------------------------

/* --| Event when player died */
public Hook_Deathmessage()
{
/* --| If plugin is on... */
if( get_pcvar_num( gDrShopOn ) == 1 )
{
/* --| Get the killer and attacker */
new killer = read_data( 1 );
new victim = read_data( 2 );

/* --| If player has died with world / trigger_hurt */
if( killer == victim )
{
return PLUGIN_HANDLED;
}
if ( is_user_bot(victim) )
{
return PLUGIN_HANDLED;
}
if ( is_user_bot(killer) )
{
return PLUGIN_HANDLED;
}
if ( !is_user_connected(killer) )
{
return PLUGIN_HANDLED;
}
if ( !is_user_connected(victim) )
{
return PLUGIN_HANDLED;
}

/* --| Setting killer points when killed a enemy */
new money = cs_get_user_money(killer);
cs_set_user_money(killer, money+get_pcvar_num( gKillerPointsCvar ) );

/* --| Reseting items */
HasHe[ victim ] = false;
HasBothGren[ victim ] = false;
HasSilent[ victim ] = false;
HasHealth[ victim ] = false;
HasArmor[ victim ] = false;
HasSpeed[ victim ] = false;
HasGravity[ victim ] = false;
HasInvis[ victim ] = false;
HasNoclip[ victim ] = false;
HasJet[ victim ] = false;
HasDeagle[ victim ] = false;
//HasLongJump[ victim ] = false;
HasGlow[ victim ] = false;
HasNVG[ victim ] = false;

set_user_gravity( victim, 1.0 );
set_user_maxspeed( victim, 0.0 );
set_user_footsteps( victim, 0 );
set_user_noclip( victim, 0 );
set_user_rendering( victim );
set_user_nvg( victim, 0 );
remove_user_nvg( victim );
remove_task( victim );
}

return PLUGIN_CONTINUE;
}
and other question to masters , what is better to use fakemeta or <engine> , e.g to create/edit/remove new entities.?

AngeIII
06-30-2010, 17:25
what you think about


if(!killer || !attacker)
{
return PLUGIN_HANDLED;
}


?

ConnorMcLeod
06-30-2010, 17:29
Hook_Deathmessage (line 449

Line 449 is not a part of Hook_Deathmessage in the plugin you attached.

AngeIII
06-30-2010, 17:58
Yes. this is because i removed any comments.

in old plugin LINE 449 is a part of
public shop_handler function.

446 case 3:
447 {
448 /* --| If already has item, show a damn print and return */
449 if( HasSilent[ id ] )
450 {
451 allready_have( id );
452 return PLUGIN_HANDLED;
453 }

ConnorMcLeod
07-01-2010, 00:51
Again, the line you show is a part of shop_handler() fonction, and not Hook_DeathMsg

edgaras85
07-01-2010, 04:39
hehe
Here plugin
Dr_shop you attached
But error on Deathrun_shop.amxx :D