Raised This Month: $ Target: $400
 0% 

Any help for this error ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
black_heart
Senior Member
Join Date: May 2015
Old 06-07-2015 , 09:35   Any help for this error ?
Reply With Quote #1

This is the error

PHP Code:
L 06/07/2015 16:44:25: [AMXXDisplaying debug trace (plugin "afkk.amxx")
L 06/07/2015 16:44:25: [AMXXRun time error 4index out of bounds 
L 06
/07/2015 16:44:25: [AMXX]    [0afkk.sma::campcheck (line 247
This is the plugin

PHP Code:
#include <amxmodx> 
#include <fun> 
#include <fakemeta> 
#include <Vexd_Utilities> 
#include <dhudmessage> 

#define VERSION "2.0" 
#define TAG "Black Gaming" 

new afk_protectionafk_protection_nrafk_protection_auto
afk_camptimeafk_movedist
afk_glowafk_glow_colorafk_glow_amount
afk_transparentafk_transparent_amount
afk_iconafk_blindafk_announce 

new isAfk[33
new 
g_SayTextSprite 

new gPlayerPosition[32][3]  // keeps track of last known origin 
new gMoveTimer[32]          // incremented if player didn't move far enough 

public plugin_init() { 
    
register_plugin("AFK Protection"VERSION"rapara13"
    
register_cvar("afk_protection"VERSIONFCVAR_SERVER|FCVAR_SPONLY
     
    
register_clcmd("say /afk","afk"
    
register_clcmd("say_team /afk","afk"
    
register_clcmd("say /cs","back"
    
register_clcmd("say_team /cs","back"
     
    
register_logevent("RoundStart",2,"1=Round_Start"
     
    
afk_protection register_cvar("afk_protection","1"
    
afk_protection_nr register_cvar("afk_protection_new_round","1"
    
afk_protection_auto register_cvar("afk_protection_auto","1"
     
    
afk_camptime register_cvar("afk_camptime""120"
    
afk_movedist register_cvar("afk_movedist""1"
     
    
afk_glow register_cvar("afk_glow","1"
    
afk_glow_color register_cvar("afk_glow_color","0 255 0"
    
afk_glow_amount register_cvar("afk_glow_amount","0"
     
    
afk_transparent register_cvar("afk_transparent","0"
    
afk_transparent_amount register_cvar("afk_transparent_amount","120"
     
    
afk_icon register_cvar("afk_icon","1"
    
afk_blind register_cvar("afk_blind","1"
    
afk_announce register_cvar("afk_annouce","20"
     
    
g_SayText get_user_msgid("SayText"
     
    if(
get_pcvar_num(afk_protection_auto)) 
        
set_task(1.0,"campcheck",0,"",0,"b" 


public 
plugin_precache() { 
    
Sprite precache_model("sprites/afk.spr"


public 
client_putinserver(id) { 
    
set_task(get_pcvar_float(afk_announce), "announce"id


public 
announce(id

    
colormsg(id"\g[%s] \tWrite /afk for \gAFK Protection."TAGVERSION


public 
client_connect(id) { 
    
isAfk[id] = false 


public 
client_disconnect(id) { 
    
isAfk[id] = false 


public 
RoundStart() { 
    new 
players[32], num 
    get_players
(players,num,"h"
    for(new 
i=0;i<num;i++) 
    { 
        if(!
get_pcvar_num(afk_protection) && !get_pcvar_num(afk_protection_nr)) 
            return 
         
        if(
isAfk[players[i]] && is_user_alive(players[i])) { 
            new 
color[17], red[5],green[7],blue[5
            new 
amount get_pcvar_num(afk_glow_amount
            new 
tamount get_pcvar_num(afk_transparent_amount
            
get_pcvar_string(afk_glow_color,color,16
            
parse(color,red,4,green,6,blue,4
             
            
set_pev(players[i],pev_flags,pev(players[i],pev_flags) | FL_FROZEN
            
set_user_godmode(players[i], 1
             
            if(
get_pcvar_num(afk_glow) == 1) { 
                
set_user_rendering(players[i], kRenderFxGlowShellstr_to_num(red), str_to_num(green), str_to_num(blue), kRenderNormalamount)
            } 
            else if(
get_pcvar_num(afk_glow) == 2) { 
                if(
get_user_team(players[i]) == 1) { 
                    
set_user_rendering(players[i], kRenderFxGlowShell25500kRenderNormalamount
                } 
                else if(
get_user_team(players[i]) == 2) { 
                    
set_user_rendering(players[i], kRenderFxGlowShell00255kRenderNormalamount
                } 
            } 
             
            if(
get_pcvar_num(afk_transparent)) { 
                
set_user_rendering(players[i], kRenderFxNone,255,255,255,kRenderTransAlpha,tamount
            } 
             
            if(
get_pcvar_num(afk_blind)) { 
                
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, players[i]) 
                
write_short(~0
                
write_short(~0
                
write_short(0x0004// stay faded 
                
write_byte(0
                
write_byte(0
                
write_byte(0
                
write_byte(255
                
message_end() 
            } 
             
            if(
get_pcvar_num(afk_icon)) { 
                
add_icon(players[i], 999999); 
            } 
        } 
        if(
is_user_alive(players[i])) { 
            
get_user_origin(players[i], gPlayerPosition[players[i]]) 
        } 
    } 


public 
afk(id) { 
    if(!
get_pcvar_num(afk_protection)) 
        return 
     
    if(
isAfk[id]) 
        return 
     
    if(
is_user_alive(id)) { 
        new 
color[17], red[5],green[7],blue[5
        
get_pcvar_string(afk_glow_color,color,16
        
parse(color,red,4,green,6,blue,4
        new 
amount get_pcvar_num(afk_glow_amount
        new 
tamount get_pcvar_num(afk_transparent_amount
             
        
set_pev(id,pev_flags,pev(id,pev_flags) | FL_FROZEN
        
set_user_godmode(id1
             
        if(
get_pcvar_num(afk_glow) == 1) { 
            
set_user_rendering(idkRenderFxGlowShellstr_to_num(red), str_to_num(green), str_to_num(blue), kRenderNormalamount
        } 
        else if(
get_pcvar_num(afk_glow) == 2) { 
            if(
get_user_team(id) == 1) { 
                
set_user_rendering(idkRenderFxGlowShell25500kRenderNormalamount
            } 
            else if(
get_user_team(id) == 2) { 
                
set_user_rendering(idkRenderFxGlowShell00255kRenderNormalamount
            } 
        } 
             
        if(
get_pcvar_num(afk_transparent)) { 
            
set_user_rendering(idkRenderFxNone,255,255,255,kRenderTransAlpha,tamount
        } 
             
        if(
get_pcvar_num(afk_blind)) { 
            
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, id
            
write_short(~0
            
write_short(~0
            
write_short(0x0004// stay faded 
            
write_byte(0
            
write_byte(0
            
write_byte(0
            
write_byte(255
            
message_end() 
        } 
             
        if(
get_pcvar_num(afk_icon)) { 
            
add_icon(id999999); 
        } 
             
        
set_dhudmessage(02550, -1.00.4306.01.0__, -1
        
show_dhudmessage(id"[%s]^nNow You are AFK Protected. To remove AFK Protection, write /cs in chat."TAG
        
isAfk[id] = true 
    
} else { 
        
colormsg(id"\g[%s] \tYou can't use AFK Protection, when you're DEAD!"TAG
    } 


public 
back(id) { 
    if(!
get_pcvar_num(afk_protection)) 
        return 
         
    if(!
isAfk[id]) 
        return 
         
    if(
is_user_alive(id)) { 
        
set_pev(id,pev_flags,pev(id,pev_flags) & ~FL_FROZEN
        
set_user_godmode(id0
             
        if(
get_pcvar_num(afk_glow)) { 
            
set_user_rendering(idkRenderFxGlowShell000kRenderNormal0
        } 
             
        if(
get_pcvar_num(afk_transparent)) { 
            
set_user_rendering(id,0,0,0,kRenderTransAlpha,0
        } 
             
        if(
get_pcvar_num(afk_blind)) { 
            
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, id
            
write_short(1<<10
            
write_short(1<<10
            
write_short(0x0000// stay faded 
            
write_byte(0
            
write_byte(0
            
write_byte(0
            
write_byte(100
            
message_end() 
        } 
             
        if(
get_pcvar_num(afk_icon)) { 
            
remove_icon(id); 
        } 
         
        
colormsg(id"\g[%s] \tYou remove \gAFK Protection."TAG
        
isAfk[id] = false 
    
} else { 
        
colormsg(id"\g[%s] \tYou can't remove \gAFK Protection, when you're DEAD!"TAG
    } 


public 
campcheck() 

    if(!
get_pcvar_num(afk_protection_auto)) 
        return 
     
    
// Check all players to see if they've moved... 
    
new origin[3
    new 
dx,dy,dz 

    
for(new 1<= 32i++) { 
        if (!
is_user_alive(i)) continue 
        if (
Entvars_Get_Int(iEV_INT_flags)&FL_NOTARGET) continue 

        
get_user_origin(i,origin
        
dx gPlayerPosition[i][0] - origin[0
        
dy gPlayerPosition[i][1] - origin[1
        
dz gPlayerPosition[i][2] - origin[2
        new 
sqrtdx*dx dy*dy dz*dz 
        if (
<= get_pcvar_num(afk_movedist)) { 
            
gMoveTimer[i]++ 
            if(
gMoveTimer[i] > get_pcvar_num(afk_camptime)) { 
                
gMoveTimer[i]=
                afk
(i
            } 
        } else { 
            
gMoveTimer[i] = 
        

        
gPlayerPosition[i][0] = origin[0
        
gPlayerPosition[i][1] = origin[1
        
gPlayerPosition[i][2] = origin[2
    } 


stock colormsg(const id, const string[], {FloatSqlResul,_}:...) { 
     
    new 
msg[191], players[32], count 1
    
vformat(msgsizeof msg 1string3); 
     
    
replace_all(msg,190,"\g","^4"); 
    
replace_all(msg,190,"\y","^1"); 
    
replace_all(msg,190,"\t","^3"); 
     
    if(
id
        
players[0] = id
    else 
        
get_players(players,count,"ch"); 
     
    for (new 
count i++) 
    { 
        if (
is_user_connected(players[i])) 
        { 
            
message_begin(MSG_ONE_UNRELIABLEg_SayText,_players[i]); 
            
write_byte(players[i]); 
            
write_string(msg); 
            
message_end(); 
        }         
    } 


stock add_icon(indexHoldTime

    if(!
is_user_connected(index)) 
        return; 
     
    
message_begin(MSG_ALLSVC_TEMPENTITY); 
    
write_byte(TE_PLAYERATTACHMENT); 
    
write_byte(index); 
    
write_coord(60); 
    
write_short(Sprite); 
    
write_short(HoldTime); 
    
message_end(); 


stock remove_icon(index

    if(!
is_user_connected(index)) 
        return; 
     
    
message_begin(MSG_ALLSVC_TEMPENTITY
    
write_byte(TE_KILLPLAYERATTACHMENTS); 
    
write_byte(index); 
    
message_end(); 


stock sqrt(num

    if (
num 0)    return sqroot(num
    return 


black_heart is offline
Send a message via Skype™ to black_heart
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-07-2015 , 09:38   Re: Any help for this error ?
Reply With Quote #2

Change this:

PHP Code:
new gPlayerPosition[32][3
to this:

PHP Code:
new gPlayerPosition[33][3
__________________
fysiks is offline
black_heart
Senior Member
Join Date: May 2015
Old 06-07-2015 , 10:23   Re: Any help for this error ?
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
Change this:

PHP Code:
new gPlayerPosition[32][3
to this:

PHP Code:
new gPlayerPosition[33][3
still have the same problem ...
black_heart is offline
Send a message via Skype™ to black_heart
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-07-2015 , 12:04   Re: Any help for this error ?
Reply With Quote #4

Quote:
Originally Posted by black_heart View Post
still have the same problem ...
Then you probably didn't compile and replace the old .amxx file properly because that will fix the issue if it issue is happening on that line of code.
__________________
fysiks is offline
black_heart
Senior Member
Join Date: May 2015
Old 06-07-2015 , 12:33   Re: Any help for this error ?
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
Then you probably didn't compile and replace the old .amxx file properly because that will fix the issue if it issue is happening on that line of code.
yeah i see it now ... thx dude! It works!
black_heart is offline
Send a message via Skype™ to black_heart
Dr Zayd
Senior Member
Join Date: Jun 2014
Location: forums.alliedmods.net
Old 06-08-2015 , 19:46   Re: Any help for this error ?
Reply With Quote #6

i was to say it :p
__________________
Invisible System | 100%
ـــــــــــــــــــــــــــــ
Anti setinfo check | Ez Plugin and lite
ـــــــــــــــــــــــــــــ
[ZP] Free VIP Menu | Free VIP menu | ZP-Mod |
Dr Zayd is offline
Reply


Thread Tools
Display Modes

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:12.


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