Raised This Month: $ Target: $400
 0% 

Annoyng bug with replace function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Unlimited!
BANNED
Join Date: Apr 2009
Old 04-13-2009 , 13:24   Annoyng bug with replace function
Reply With Quote #1

I'm using replace_all function, and it says this
Quote:
L 04/13/2009 - 00:00:13: replace() buffer not big enough (35>=33)
L 04/13/2009 - 00:00:13: [AMXX] Displaying debug trace (plugin "zombie_plague40.amxx")
L 04/13/2009 - 00:00:13: [AMXX] Run time error 10: native error (native "replace")
L 04/13/2009 - 00:00:13: [AMXX] [0] string.inc::replace_all (line 239)
L 04/13/2009 - 00:00:13: [AMXX] [1] zombie_plague40.sma::save_data3 (line 959
L 04/13/2009 - 00:00:13: [AMXX] [2] zombie_plague40.sma::save_data2 (line 9523)
L 04/13/2009 - 00:00:13: [AMXX] [3] zombie_plague40.sma::save_data (line 9493)
L 04/13/2009 - 00:00:13: [AMXX] [4] zombie_plague40.sma::client_disconnect (line 1645)
In few words, replace_all drops this error: buffer not big enough (35>=33)

Im using this code
PHP Code:
    /* LOGGING*/
    
static name[27]
    
get_user_name(idname26)
    static 
file2[70]
    
formatex(file2sizeof file2 1"Logs_%s.log"name)
    
replace_all(file239"\", "char1")
    replace_all(file2, 39, "
|", "char2")
    replace_all(file2, 39, "
/", "char3")
    replace_all(file2, 39, "
*", "char4")
    replace_all(file2, 39, "
:", "char5")
    replace_all(file2, 39, "
<", "char6")
    replace_all(file2, 39, "
>", "char7")
    replace_all(file2, 39, "
^"""char8")
    
replace_all(file239"?""char9")
    
log_to_file(file2"---------------")
    
log_to_file(file2"Accediendo a estadisticas de %s"name)
    
log_to_file(file2"%s - Puntos Zombie - %i"namestr_to_num(vaultdata))
    
log_to_file(file2"%s - Zombies Matados - %i"namestr_to_num(vaultdata2))
    
log_to_file(file2"%s - Humanos Infectados - %i"namestr_to_num(vaultdata3))
    
log_to_file(file2"%s - Clase Zombie - %i"namestr_to_num(vaultdata4))
    
log_to_file(file2"%s - Armas Automaticas - %i"namestr_to_num(vaultdata5))
    
log_to_file(file2"%s - Arma Primaria - %i"namestr_to_num(vaultdata6))
    
log_to_file(file2"%s - Arma Secundaria - %i"namestr_to_num(vaultdata7))
    
log_to_file(file2"%s - Granadas - %i"namestr_to_num(vaultdata8))
    
log_to_file(file2"Accedidas estadisticas de %s"name)
    
log_to_file(file2"---------------")
    return 
PLUGIN_HANDLED;
    
/* LOGGING*/ 
Unlimited! is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-13-2009 , 13:31   Re: Annoyng bug with replace function
Reply With Quote #2

Why 39 and not sizeof file2 - 1 ?
Arkshine is offline
Unlimited!
BANNED
Join Date: Apr 2009
Old 04-13-2009 , 13:39   Re: Annoyng bug with replace function
Reply With Quote #3

Quote:
Originally Posted by arkshine View Post
Why 39 and not sizeof file2 - 1 ?
Ohh, I'm blind though. Sorry this is not my day LOL
Unlimited! is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 04-13-2009 , 15:09   Re: Annoyng bug with replace function
Reply With Quote #4

Quote:
Originally Posted by arkshine View Post
Why 39 and not sizeof file2 - 1 ?
Any reason to avoid charsmax( file2 ) ? Is it just preference, or is there more to it?
__________________
stupok is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-13-2009 , 15:20   Re: Annoyng bug with replace function
Reply With Quote #5

I don't avoid it. He uses sizeof in its script, that's why I said sizeof instead of charsmax, better understandable for him.
Arkshine 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 02:20.


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