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

[Error Log Help] function "copy"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 01-31-2015 , 16:11   [Error Log Help] function "copy"
Reply With Quote #1

Hello, i got an error log, in this chat tag's plugin,,i just modified the tag format from the original one....anyone can solve this pls ? thnx

Code:
Start of error session.
L 01/20/2015 - 01:52:13: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20150120.log")
L 01/20/2015 - 01:52:13: [AMXX] Displaying debug trace (plugin "chat_tags.amxx")
L 01/20/2015 - 01:52:13: [AMXX] Run time error 4: index out of bounds
L 01/20/2015 - 01:52:13: [AMXX]    [0] chat_tags.sma::loadTags (line 317)
L 01/20/2015 - 01:52:13: [AMXX]    [1] chat_tags.sma::plugin_init (line 78)
line 317
PHP Code:
copy(g_szTags[iTagCount], charsmax(g_szTags[]), szTag
"loadTags" part...
PHP Code:
loadTags()
{
        
// load tags from file
        
new szFilePath[128]
        
get_configsdir(szFilePathcharsmax(szFilePath))
        
add(szFilePathcharsmax(szFilePath), "/Admintags.ini")
       
        new 
fopen(szFilePath"rt")
       
        if(!
f)
        {
                new 
szMessage[128]
                
formatex(szMessagecharsmax(szMessage), "Unable to open %s"szFilePath)
                
set_fail_state(szMessage)
        }
       
        new 
data[64], iTagCount 0szName[32], szTag[sizeof(g_szTags[])];
        while(!
feof(f))
        {
                
fgets(fdatacharsmax(data))
               
                
trim(data)
                if(!
data[0] || data[0] == ';' || data[0] == '/' && data[1] == '/') continue;
               
                
strtok(dataszNamecharsmax(szName), szTagcharsmax(szTag), '=')
                if(
szName[0] && szTag[0])
                {
                        
iTagCount++
                        
copy(g_szTags[iTagCount], charsmax(g_szTags[]), szTag)
                        
TrieSetCell(g_tNameTagIndexszNameiTagCount)
                }
        }
        
fclose(f)

the tag format should be

Code:
MyName = MyTag
__________________

Last edited by ghost95v; 01-31-2015 at 16:59.
ghost95v is offline
Send a message via Skype™ to ghost95v
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-31-2015 , 16:19   Re: [Error Log Help] function "copy"
Reply With Quote #2

The error has nothing to do with copy() or with how you are defining your file format. Look at the only indexing you are doing on that line and investigate. Index out of bounds means the index gets larger (or equal to) the size of the array.
__________________

Last edited by fysiks; 01-31-2015 at 16:20.
fysiks is online now
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 01-31-2015 , 16:30   Re: [Error Log Help] function "copy"
Reply With Quote #3

Got it. and i have this

PHP Code:
new g_szTags[50][30
and in my .INI file i have more than "50" clients with tag's...
this means, that count of tags i did, are bigger than the array size of g_szTags ?.. yes.
__________________

Last edited by ghost95v; 01-31-2015 at 16:34.
ghost95v is offline
Send a message via Skype™ to ghost95v
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-31-2015 , 16:38   Re: [Error Log Help] function "copy"
Reply With Quote #4

Are you asking a question?
__________________
fysiks is online now
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 01-31-2015 , 16:40   Re: [Error Log Help] function "copy"
Reply With Quote #5

Yes, just asking to be sure. if its that the problem.
__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-31-2015 , 19:48   Re: [Error Log Help] function "copy"
Reply With Quote #6

Quote:
Originally Posted by ghost95v View Post
Yes, just asking to be sure. if its that the problem.
You can answer it for yourself.
__________________
fysiks is online now
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:59.


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