AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   event_death [HELP] (https://forums.alliedmods.net/showthread.php?t=329396)

Id0x. 12-22-2020 05:21

event_death [HELP]
 
Code:

L 12/22/2020 - 06:35:04: [AMXX] Displaying debug trace (plugin "level.amxx", version "v5.2")
L 12/22/2020 - 06:35:04: [AMXX] Run time error 4: index out of bounds
L 12/22/2020 - 06:35:04: [AMXX]    [0] phph2kN7x.sma::event_death (line 93)

PHP Code:

public event_death()
{
    new 
name[32], attacker read_data(1);
    
get_user_name(attackernamesizeof name 1); new 1;
    
    if((
g_exp[attacker] >= (g_exp2[attacker] - 1)) && (g_level[attacker] <= get_pcvar_num(g_max)) && is_user_alive(attacker))
    {
        
g_level[attacker] ++;
        
g_exp[attacker] = 0;    
        
        while(
g_level[attacker] != y)
        {
            
++; g_exp2[attacker] = 5;
        }
        
        
message_begin(MSG_ONE_UNRELIABLEg_fade_attacker);
        
write_short(1<<12);
        
write_short(1);
        
write_short(0x0000);
        
write_byte(1);
        
write_byte(200); 
        
write_byte(0);
        
write_byte(205);
        
message_end();
        
        
emit_sound(attackerCHAN_STREAMsound1.0ATTN_NORM0PITCH_HIGH);
        
ChatColor(0"!nPlayer!t %s !nUp Level to!g %d !t!"nameg_level[attacker]);
    }
    else
    {        
        if(!(
g_level[attacker] == get_pcvar_num(g_max))) g_exp[attacker] ++;            
    }


Line 93 :
PHP Code:

if((g_exp[attacker] >= (g_exp2[attacker] - 1)) && (g_level[attacker] <= get_pcvar_num(g_max)) && is_user_alive(attacker)) 


OciXCrom 12-22-2020 07:24

Re: event_death [HELP]
 
Why simply not use this instead?
https://forums.alliedmods.net/showthread.php?t=308540

Anyways, you can probably fix the error by adding this in the beginning of the function (after the line that contains 'read_data'):

Code:
if(!is_user_connected(attacker)) return

Id0x. 12-22-2020 07:39

Re: event_death [HELP]
 
Quote:

Originally Posted by OciXCrom (Post 2729736)
Why simply not use this instead?
https://forums.alliedmods.net/showthread.php?t=308540

Anyways, you can probably fix the error by adding this in the beginning of the function (after the line that contains 'read_data'):

Code:
if(!is_user_connected(attacker)) return

i want use your plugin, but the players levels will reset :(

OciXCrom 12-22-2020 09:26

Re: event_death [HELP]
 
Eventually you will need to restart it. Plus, I don't think players would mind having new ranks and a better plugin for the job.


All times are GMT -4. The time now is 14:11.

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