Raised This Month: $51 Target: $400
 12% 

top benefit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
El Abuelo Loco
Senior Member
Join Date: Jun 2020
Old 12-14-2020 , 22:56   top benefit
Reply With Quote #1

I am using this top3, simple it gives benefit to those who are above the top the thing that throws me this error and I don't know how to fix it.

HTML Code:
L 12/14/2020 - 13:33:42: Info (map "de_aztec") (file "addons/amxmodx/logs/error_20201214.log")
L 12/14/2020 - 13:33:42: [AMXX] Displaying debug trace (plugin "top_awards.amxx", version "1.0")
L 12/14/2020 - 13:33:42: [AMXX] Run time error 4: index out of bounds
L 12/14/2020 - 13:33:42: [AMXX]    [0] top_awards.sma::client_give_awards (line 118)
PHP Code:
/*
    Copyright by Dom1no_[KZ]
    2019 © https://vk.com/m.kent03
*/

#include <amxmodx>

#if AMXX_VERSION_NUM < 183
    #include <colorchat>
#endif

#define    PLUGIN    "Top Awards"
#define    VERSION    "1.0"
#define    AUTHOR    "Dom1no_[KZ]"

/* Настройки */
#define IGNORE_FLAGS (ADMIN_MENU)
    //    Игнорируемые флаги
    //    Закоментируйте если не требуется

#define    STATS_SYSTEM 0 // Система записи статистики
    //    0 - CSX
    //    1 - CsStats MySQL by SKAJIbnEJIb
    //    2 - CsStatsX SQL by serfreeman1337

#define MAX_AWARDS 256
    // Максимальная количество наград

const FloatTIME 3.0;
    
// Задержка в секундах перед проверкой игрока

enum _:DATA {
    
FLAGS[32],
    
MSG[128]
};
new 
g_arrAwardData[MAX_AWARDS][DATA], g_iDataSize 1;
#if    STATS_SYSTEM == 0
    #include <csx>
    #define    get_player_stats get_user_stats
#endif
#if    STATS_SYSTEM == 1
    #include <csstats_mysql>
#endif
#if    STATS_SYSTEM == 2
    #include <csstatsx_sql>
    #define    get_player_stats get_user_stats_sql
#endif

public plugin_init(){
    
register_plugin(PLUGINVERSIONAUTHOR);
}

public 
plugin_cfg(){
    new 
szPath[64];
    
get_localinfo("amxx_configsdir"szPathcharsmax(szPath));
    
add(szPathcharsmax(szPath), "/top_awards.ini");

    new 
iFile fopen(szPath"rt");
    if(!
iFile){
        new 
szError[96];
        
formatex(szErrorcharsmax(szError), "File '%s' not found OR incorrect CHMOD!"szPath);
        
set_fail_state(szError);
    }

    new 
szBuffer[MAX_AWARDS];
    while(!
feof(iFile)){
        
fgets(iFileszBuffercharsmax(szBuffer));
        
trim(szBuffer);

        if(!
szBuffer[0] || szBuffer[0] == ';')
            continue;

        if(
parse(szBuffer
            
g_arrAwardData[g_iDataSize][FLAGS], charsmax(g_arrAwardData[][FLAGS]),
            
g_arrAwardData[g_iDataSize][MSG], charsmax(g_arrAwardData[][MSG])
        ) == 
2)    g_iDataSize++;
    }
    
fclose(iFile);
}

public 
client_putinserver(id){
    
set_task(TIME"client_give_awards"id);
}

public 
client_give_awards(id){
    new 
g_iAccessszName[32];
    
g_iAccess get_user_flags(id);
    
get_user_name(idszNamecharsmax(szName));

    if(!
is_user_connected(id)){
        return;
    }
    
#if defined IGNORE_FLAGS
        
if(g_iAccess IGNORE_FLAGS){
            return;
        }
    
#endif

    #if    STATS_SYSTEM == 0 || STATS_SYSTEM == 2
        
new szStats[8];
        new 
iRank get_player_stats(idszStatsszStats);
    
#else
        
new szStats[22];
        new 
iRank csstats_get_user_stats(idszStats);
    
#endif

    
if(iRank <= g_iDataSize){
        
set_user_flags(idg_iAccess read_flags(g_arrAwardData[iRank][FLAGS]));

        
replace_all(g_arrAwardData[iRank][MSG], charsmax(g_arrAwardData[][MSG]), "!n""^1");
        
replace_all(g_arrAwardData[iRank][MSG], charsmax(g_arrAwardData[][MSG]), "!t""^3");
        
replace_all(g_arrAwardData[iRank][MSG], charsmax(g_arrAwardData[][MSG]), "!g""^4");
        
replace_all(g_arrAwardData[iRank][MSG], charsmax(g_arrAwardData[][MSG]), "%name%"szName);

        
client_print_color(idprint_team_default"%s"g_arrAwardData[iRank][MSG]);
    }
    else{
        
remove_user_flags(idg_arrAwardData[iRank][FLAGS]);
    }

El Abuelo Loco 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 18:06.


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