SA-MP Forums Archive
Crashes server after 10 - 11 hours. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Crashes server after 10 - 11 hours. (/showthread.php?tid=316718)



Crashes server after 10 - 11 hours. - Lorenc_ - 08.02.2012

Hi, all. This is a occurence that has been applied to my previous gamemode based on Call of Duty, it's got nothing to do with my current.

pawn Код:
stock Lorenc( )
{
    return fixed_function;
}
this simple code here crashes the server I assume, given by crashdetect. And I got to admit, I guess it is indeed.

pawn Код:
#define strcpy(%0,%1,%2)            strcat((%0[0]='\0',%0),%1,%2)
That's the strcpy function I have, anyway.

It prints 2 "lol" comments, weird but still trying to see what's wrong lol. Would be good if I discovered what's wrong so I can open another server, probably.


Re: Crashes server after 10 - 11 hours. - Max_Coldheart - 08.02.2012

I don't know how to use define that well, but isn't this strcpy?:
pawn Код:
stock strcpy(dest[], const source[], maxlength=sizeof dest)
{
    strcat((dest[0] = EOS, dest), source, maxlength);
}



Re: Crashes server after 10 - 11 hours. - Lorenc_ - 08.02.2012

What's the difference between mine and that? I have doubts that mine may be faster as well

EDIT: I've fixed it, like a boss.


Re: Crashes server after 10 - 11 hours. - MP2 - 08.02.2012

You shouldn't debug like that. It's better to do something "debug 1" "debug 2" not all the same messages.


Re: Crashes server after 10 - 11 hours. - IceCube! - 08.02.2012

Now I'm not sure how to use define ones but this might solve it it goes by the lengh of the string.... Its like a safe version of it. Its slower I think than yours...

pawn Код:
stock strcpy(dest[], source[])
{
     for (i = 0; i < strlen(source); i ++)
    {
        dest[i] = source[i];
    }
}



Re: Crashes server after 10 - 11 hours. - Lorenc_ - 08.02.2012

Quote:
Originally Posted by MP2
Посмотреть сообщение
You shouldn't debug like that. It's better to do something "debug 1" "debug 2" not all the same messages.
If you cannot count you can do that, I wont take that idea.

I've fixed the issue guys, no-one has given me the closest answer to this solution thus i'm not giving rep to anyone.

pawn Код:
new log__Text[5][MAX_LOG_STR];
new log__Line[5];
I forgot to increase that by 5 lol.