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

[Debug] Info Rank


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
khashayar007
Senior Member
Join Date: Jan 2015
Location: Macedonia
Old 04-01-2017 , 17:41   [Debug] Info Rank
Reply With Quote #1

Hi. Please fix this code

PHP Code:
[AMXXDisplaying debug trace (plugin "info_rank.amxx")
Run time error 4index out of bounds 
[0colorchat.inc::ColorChat (line 76)
[
1info_rank.sma::event_player_spawn (line 86)
[
2info_rank.sma::eResetHUD (line 61
PHP Code:
//Uncomment line below if you want messages to be disabled by default (aka players have to type /inrorank to enable them)
//#define DISABLED_BY_DEFAULT

#include <amxmodx>
#include <csx>
#include <colorchat>

#define MAX_PLAYERS 32
new bool:g_RestartAttempt[MAX_PLAYERS+1]

new 
g_oldrank[MAX_PLAYERS+1]

#if defined DISABLED_BY_DEFAULT
new bool:disabled[MAX_PLAYERS+1] = {true, ...}
#else
new bool:disabled[MAX_PLAYERS+1]
#endif

new inforank

public plugin_init() {
    
register_plugin("Info Rank""1.0""connor")
    
register_dictionary("inforank.txt")

    
inforank register_cvar("amx_inforank""1")

    
register_event("TextMsg""eRestartAttempt""a""2=#Game_will_restart_in")
    
register_event("ResetHUD""eResetHUD""be")

    
register_clcmd("say /inforank","switchCmd"0"- enable/disable info rank messages")
    
register_clcmd("say_team /inforank","switchCmd"0"- enable/disable info rank messages")
    
register_clcmd("fullupdate""fullupdateCmd")
}

public 
fullupdateCmd() {
    return 
PLUGIN_HANDLED_MAIN
}

public 
eRestartAttempt() {
    if(!
get_pcvar_num(inforank))
        return

    new 
players[MAX_PLAYERS], num
    get_players
(playersnum"a")
    for (new 
inum; ++i)
        
g_RestartAttempt[players[i]] = true
}

public 
eResetHUD(id) {
    if (
g_RestartAttempt[id]) {
        
g_RestartAttempt[id] = false
        
return
    }
    
    if(!
get_pcvar_num(inforank))
        return

    if(
disabled[id])
        return

    
event_player_spawn(id)
}
 
public 
event_player_spawn(id) {

    new 
osef[8]
    new 
rank get_user_stats(idosefosef)
    new 
maxrank get_statsnum()
    
    if(
g_oldrank[id] == 0)
        
g_oldrank[id] = rank
    
    
new diff g_oldrank[id] - rank
    g_oldrank
[id] = rank
    
    
new mess[256]
    if(
diff 0) {        
        
formatex(mess191"%L"id"IR_GOOD"diff)
        
ColorChat(idGREENmess)
    }
    else if(
diff 0) {
        
formatex(mess191"%L"id"IR_BAD"abs(diff))
        
ColorChat(idREDmess)
    }
    
formatex(mess191"^3%Ltest"id"IR_RANK"rankmaxrank)
    
ColorChat(idGREYmess)
}

public 
switchCmd(id) {
    if(!
get_pcvar_num(inforank))
        return 
PLUGIN_CONTINUE

    
if(disabled[id]) {
        
disabled[id] = false
        client_cmd
(id"setinfo _ir 1")
        
client_print(idprint_chat"%L"id"IR_ENABLE")
    }
    else {
        
disabled[id] = true
        client_cmd
(id"setinfo _ir 0")
        
client_print(idprint_chat"%L"id"IR_DISABLE")
    }
    return 
PLUGIN_CONTINUE
}

public 
client_authorized(id) {
    new 
osef[8]
    
g_oldrank[id] = get_user_stats(idosefosef)

    new 
enable[2]
    
get_user_info(id"_ir"enable1)
    if(!
enable[0])
        return

    if(
enable[0]=='1')
        
disabled[id] = false
    
else
        
disabled[id] = true
}

public 
client_disconnect(id) {
    
g_oldrank[id] = 0

#if defined DISABLED_BY_DEFAULT
    
disabled[id] = true
#else
    
disabled[id] = false
#endif


Last edited by khashayar007; 04-01-2017 at 17:41.
khashayar007 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-01-2017 , 17:52   Re: [Debug] Info Rank
Reply With Quote #2

Try

PHP Code:
public event_player_spawn(id) {

    new 
osef[8]
    new 
rank get_user_stats(idosefosef)
    new 
maxrank get_statsnum()
    
    if(
g_oldrank[id] == 0)
        
g_oldrank[id] = rank
    
    
new diff g_oldrank[id] - rank
    g_oldrank
[id] = rank
    
    
new mess[256]
    if(
diff 0) {        
        
formatex(mess191"%L"id"IR_GOOD"diff)
        
ColorChat(idGREENmess)
    }
    else if(
diff 0) {
        
formatex(mess191"%L"id"IR_BAD"abs(diff))
        
ColorChat(idREDmess)
    }
    
formatex(mess191"^3%Ltest"id"IR_RANK"rankmaxrank)
    
ColorChat(idGREYmess)

->

PHP Code:
public event_player_spawn(id
{
    new 
osef[8]
    new 
rank get_user_stats(idosefosef)
    new 
maxrank get_statsnum()
    
    if(
g_oldrank[id] == 0)
        
g_oldrank[id] = rank
    
    
new diff g_oldrank[id] - rank
    g_oldrank
[id] = rank
    
    
new mess[256]
    
    if(
diff 0
    {        
        
formatex(messcharsmax(mess), "%L"id"IR_GOOD"diff)
        
ColorChat(idGREENmess)
    }
    else if(
diff 0
    {
        
formatex(messcharsmax(mess), "%L"id"IR_BAD"abs(diff))
        
ColorChat(idREDmess)
    }
    
formatex(messcharsmax(mess), "^3%L"id"IR_RANK"rankmaxrank)
    
ColorChat(idGREYmess)

__________________

Last edited by EFFx; 04-01-2017 at 17:53.
EFFx is offline
Send a message via Skype™ to EFFx
khashayar007
Senior Member
Join Date: Jan 2015
Location: Macedonia
Old 04-02-2017 , 04:38   Re: [Debug] Info Rank
Reply With Quote #3

Error:
PHP Code:
[AMXXDisplaying debug trace (plugin "info_rank.amxx")
[
AMXXRun time error 4index out of bounds
[AMXX]    [0colorchat.inc::ColorChat (line 76)
[
AMXX]    [1info_rank.sma::event_player_spawn (line 89)
[
AMXX]    [2info_rank.sma::eResetHUD (line 61

Last edited by khashayar007; 04-02-2017 at 04:39.
khashayar007 is offline
[email protected]
Junior Member
Join Date: Mar 2017
Location: India
Old 04-02-2017 , 08:50   Re: [Debug] Info Rank
Reply With Quote #4

Use this one..

https://forums.alliedmods.net/showthread.php?p=529445

https://forums.alliedmods.net/showth...=94960?t=94960

Last edited by [email protected]; 04-02-2017 at 08:51.
B@IL is offline
khashayar007
Senior Member
Join Date: Jan 2015
Location: Macedonia
Old 04-02-2017 , 14:44   Re: [Debug] Info Rank
Reply With Quote #5

this version uses colorchat.amxx and I don't want to use colorchat.
Can someone fix those errors?
khashayar007 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-02-2017 , 14:56   Re: [Debug] Info Rank
Reply With Quote #6

Just use your colorchat dude.
__________________
EFFx is offline
Send a message via Skype™ to EFFx
[email protected]
Junior Member
Join Date: Mar 2017
Location: India
Old 04-02-2017 , 15:00   Re: [Debug] Info Rank
Reply With Quote #7

Quote:
Originally Posted by khashayar007 View Post
this version uses colorchat.amxx and I don't want to use colorchat.
Can someone fix those errors?
Using 1.8.3 or 1.8.2??
B@IL is offline
khashayar007
Senior Member
Join Date: Jan 2015
Location: Macedonia
Old 04-02-2017 , 16:04   Re: [Debug] Info Rank
Reply With Quote #8

1.8.2
khashayar007 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 16:04.


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