Raised This Month: $ Target: $400
 0% 

What i did wrong here?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 10-21-2011 , 06:29   What i did wrong here?
Reply With Quote #1

Hi,

I have problem.

PHP Code:
 
public fw_PlayerKilled(victimattackershouldgib)
{
 
     if (
get_pcvar_num(cvar_nemfraggore))
     {
          if (
g_assassin[attacker]) // This is 2406
         
{
                 
SetHamParamInteger(32)
         }
     }

And the error logs show me :

Quote:
L 10/21/2011 - 10:25:23: [AMXX] Displaying debug trace (plugin "DarkAngels.amxx")
L 10/21/2011 - 10:25:23: [AMXX] Run time error 4: index out of bounds
L 10/21/2011 - 10:25:23: [AMXX] [0] DarkAngels.sma::fw_PlayerKilled (line 2406)

What i did wrong here?

Is a Attacker Index invalid number?
should i check this

Is_connected
Is_valid_id
is_alive

Idk know anymore, i have try to do it but it is not helping.

When i have add this, one week this was okey ( no error logs )
But now, this line spam a error logs.


Mayby error come when player killed by gravity or something
.Dare Devil. is offline
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 10-21-2011 , 07:09   Re: What i did wrong here?
Reply With Quote #2

if(!is_user_connected(attacker))
return HAM_IGNORED
__________________
Preparing to release my plugins..
r0ck is offline
Stereo
Veteran Member
Join Date: Dec 2010
Old 10-21-2011 , 08:31   Re: What i did wrong here?
Reply With Quote #3

And check if the attacker is valid player:

PHP Code:
public fw_PlayerKilled(victimattackershouldgib)
{
    if (
get_pcvar_num(cvar_nemfraggore))
    {
        if (
g_assassin[attacker] && is_user_connected(attacker) && <= attacker <= get_maxplayers()) // This is 2406
        
{
            
SetHamParamInteger(32)
        }
    }

Stereo is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-21-2011 , 09:08   Re: What i did wrong here?
Reply With Quote #4

is_user_connected() takes care of that, you don't need both.
__________________

Last edited by Bugsy; 10-21-2011 at 09:34.
Bugsy is offline
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 10-21-2011 , 09:59   Re: What i did wrong here?
Reply With Quote #5

ya
__________________
Preparing to release my plugins..
r0ck is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-21-2011 , 10:27   Re: What i did wrong here?
Reply With Quote #6

You need to put the is_user_connected check first though because the error can/will happen in the array (where the error occurred in first post) before the connected check is done. If the connected check fails, the execution will not hit the array.
PHP Code:
public fw_PlayerKilled(victimattackershouldgib)
{
    if (
get_pcvar_num(cvar_nemfraggore))
    {
        if (
is_user_connected(attacker) && g_assassin[attacker]) // This is 2406
        
{
            
SetHamParamInteger(32)
        }
    }

__________________

Last edited by Bugsy; 10-21-2011 at 10:32.
Bugsy 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 20:41.


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