[Ajuda] Crashando
#1

Код:
[19/01/2001 00:41:41] [debug] Server crashed while executing BRLS.amx
[19/01/2001 00:41:41] [debug] AMX backtrace:
[19/01/2001 00:41:41] [debug] #0 native SendClientMessage () from samp03svr
[19/01/2001 00:41:41] [debug] #1 008dd210 in public OnPlayerCommandText (3, 791684) from BRLS.amx
[19/01/2001 00:41:41] [debug] #2 001d61bc in public OnDialogResponse (3, 4, 1, -1, 8385896) from BRLS.amx
[19/01/2001 00:41:41] [debug] Native backtrace:
[19/01/2001 00:41:41] [debug] #0 f7460e8b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[19/01/2001 00:41:41] [debug] #1 f7459bcf in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[19/01/2001 00:41:41] [debug] #2 f745adbc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[19/01/2001 00:41:41] [debug] #3 f745b226 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[19/01/2001 00:41:41] [debug] #4 f7460adc in ?? () from plugins/crashdetect.so
[19/01/2001 00:41:41] [debug] #5 f77a5410 in ?? ()
[19/01/2001 00:41:41] [debug] #6 f74cbccf in _IO_vfprintf () from /lib32/libc.so.6
[19/01/2001 00:41:41] [debug] #7 f74ea102 in vsprintf () from /lib32/libc.so.6
[19/01/2001 00:41:41] [debug] #8 080ad731 in ?? () from ./samp03svr
[19/01/2001 00:41:41] [debug] #9 080d99e9 in ?? () from ./samp03svr
[19/01/2001 00:41:41] [debug] #10 080950e4 in ?? () from ./samp03svr
[19/01/2001 00:41:41] [debug] #11 f745c94b in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[19/01/2001 00:41:41] [debug] #12 f745f8f8 in ?? () from plugins/crashdetect.so
[19/01/2001 00:41:41] [debug] #13 f7463916 in amx_Exec () from plugins/crashdetect.so
[19/01/2001 00:41:41] [debug] #14 f745bbe6 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[19/01/2001 00:41:41] [debug] #15 f745f659 in ?? () from plugins/crashdetect.so
[19/01/2001 00:41:41] [debug] #16 f73a8406 in ?? () from plugins/streamer.so
[19/01/2001 00:41:41] [debug] #17 080a682f in ?? () from ./samp03svr
[19/01/2001 00:41:41] [debug] #18 080b2c44 in ?? () from ./samp03svr
[19/01/2001 00:41:41] [debug] #19 08071d38 in ?? () from ./samp03svr
[19/01/2001 00:41:41] [debug] #20 08071e32 in ?? () from ./samp03svr
[19/01/2001 00:41:41] [debug] #21 0807bc50 in ?? () from ./samp03svr
[19/01/2001 00:41:41] [debug] #22 080aed3d in ?? () from ./samp03svr
[19/01/2001 00:41:41] [debug] #23 080aef02 in ?? () from ./samp03svr
[19/01/2001 00:41:41] [debug] #24 080aa13a in ?? () from ./samp03svr
[19/01/2001 00:41:41] [debug] #25 f749da63 in __libc_start_main () from /lib32/libc.so.6
Alguйm sabe como retirar esse crash ai? Tentei colocar oq me falaram (no final da gamemode)

Код:
forward SendClientMessageEx(playerid, color, const message[]);
public SendClientMessageEx(playerid, color, const message[]) {
    new messagef[256];
    format(messagef, (256), "%s", message);
    if(strlen(message) > 0)
    {
        format(messagef, (256), "%s", \
        str_replace("%", "%%", messagef));
    }
    else format(messagef, (256), "%s", " ");
    return SendClientMessage(playerid, color, messagef);
}

#if defined _ALS_SendClientMessage
    #undef SendClientMessage
#else
    #define _ALS_SendClientMessage
#endif
#define SendClientMessage SendClientMessageEx
Mas da esse erro aqui

Код:
undefined symbol "str_replace"
Reply
#2

Troque esse: "str_replace" por "strreplace".
Em seguida, adicione no final do script.
PHP код:
stock strreplace(string[], const search[], const replacement[], bool:ignorecase falsepos 0limit = -1maxlength sizeof(string)) {
    
// No need to do anything if the limit is 0.
    
if (limit == 0)
        return 
0;
    
    new
             
sublen strlen(search),
             
replen strlen(replacement),
        
bool:packed ispacked(string),
             
maxlen maxlength,
             
len strlen(string),
             
count 0
    
;
    
    
    
// "maxlen" holds the max string length (not to be confused with "maxlength", which holds the max. array size).
    // Since packed strings hold 4 characters per array slot, we multiply "maxlen" by 4.
    
if (packed)
        
maxlen *= 4;
    
    
// If the length of the substring is 0, we have nothing to look for..
    
if (!sublen)
        return 
0;
    
    
// In this line we both assign the return value from "strfind" to "pos" then check if it's -1.
    
while (-!= (pos strfind(stringsearchignorecasepos))) {
        
// Delete the string we found
        
strdel(stringpospos sublen);
        
        
len -= sublen;
        
        
// If there's anything to put as replacement, insert it. Make sure there's enough room first.
        
if (replen && len replen maxlen) {
            
strins(stringreplacementposmaxlength);
            
            
pos += replen;
            
len += replen;
        }
        
        
// Is there a limit of number of replacements, if so, did we break it?
        
if (limit != -&& ++count >= limit)
            break;
    }
    
    return 
count;

Reply
#3

Quote:
Originally Posted by Pool
Посмотреть сообщение
Troque esse: "str_replace" por "strreplace".
Em seguida, adicione no final do script.
PHP код:
stock strreplace(string[], const search[], const replacement[], bool:ignorecase falsepos 0limit = -1maxlength sizeof(string)) {
    
// No need to do anything if the limit is 0.
    
if (limit == 0)
        return 
0;
    
    new
             
sublen strlen(search),
             
replen strlen(replacement),
        
bool:packed ispacked(string),
             
maxlen maxlength,
             
len strlen(string),
             
count 0
    
;
    
    
    
// "maxlen" holds the max string length (not to be confused with "maxlength", which holds the max. array size).
    // Since packed strings hold 4 characters per array slot, we multiply "maxlen" by 4.
    
if (packed)
        
maxlen *= 4;
    
    
// If the length of the substring is 0, we have nothing to look for..
    
if (!sublen)
        return 
0;
    
    
// In this line we both assign the return value from "strfind" to "pos" then check if it's -1.
    
while (-!= (pos strfind(stringsearchignorecasepos))) {
        
// Delete the string we found
        
strdel(stringpospos sublen);
        
        
len -= sublen;
        
        
// If there's anything to put as replacement, insert it. Make sure there's enough room first.
        
if (replen && len replen maxlen) {
            
strins(stringreplacementposmaxlength);
            
            
pos += replen;
            
len += replen;
        }
        
        
// Is there a limit of number of replacements, if so, did we break it?
        
if (limit != -&& ++count >= limit)
            break;
    }
    
    return 
count;

Com isso nгo irгo mais crashar o servidor?
Reply
#4

#include <strlib>

https://sampforum.blast.hk/showthread.php?tid=85697
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)