OnPlayerText problem.
#1

I have a problem with OnPlayerText.
When I add this callback function in my gamemode and when somebody write colour code like this in the chat - {ffffff} the server has restarted.
But when I remove OnPlayerText from my gamemode the server didn't restarted when somebody write colour code like this in the top.
I need this callback function OnPlayerText for somethings.
How to fix this ?
Reply
#2

if(!strlen(text)) return 0;

Put that at the top of OnPlayerText
Reply
#3

Quote:
Originally Posted by MP2
Посмотреть сообщение
if(!strlen(text)) return 0;

Put that at the top of OnPlayerText
Still restarting
Reply
#4

Try this
pawn Код:
public OnPlayerText( playerid, text[ ] )
{
    for( new i; i < 129; i ++ )
    {
         if( text[ i ] == '{' ) text[ i ] = '(';
         if( text[ i ] == '}' ) text[ i ] = ')';
    }
    // Another of your code, if you have
}
Reply
#5

Quote:
Originally Posted by Kostas'
Посмотреть сообщение
Try this
pawn Код:
public OnPlayerText( playerid, text[ ] )
{
    for( new i; i < 129; i ++ )
    {
         if( text[ i ] == '{' ) text[ i ] = '(';
         if( text[ i ] == '}' ) text[ i ] = ')';
    }
    // Another of your code, if you have
}
I already tried this and still restarting, also this codes disable the chat, I mean I can't write in the chat.
Reply
#6

Debug.

pawn Код:
public OnPlayerText(playerid, text[])
{
    print("OPT: 1");

    // code

    print("OPT: 2");

    // code

    print("OPT: 3");

    // code

    print("OPT: 4");

    // code

    print("OPT: 5");
    return 1;
}
Reply
#7

MP2 what you mean with this '// code' ?
Reply
#8

I suppose he thinks that something in your code is wrong... he wants you to place thise "debug" methods into different places on your OnPlayerText codes... although I suppose that will not help as it's some samp bug and not a scripting failure I suppose.. not sure how to fix it though
Reply
#9

Quote:
Originally Posted by Sascha
Посмотреть сообщение
I suppose he thinks that something in your code is wrong... he wants you to place thise "debug" methods into different places on your OnPlayerText codes... although I suppose that will not help as it's some samp bug and not a scripting failure I suppose.. not sure how to fix it though
So from where I can get "debug" ?
Reply
#10

Quote:
Originally Posted by Sascha
Посмотреть сообщение
I suppose he thinks that something in your code is wrong
Of course his code is wrong...

Put prints every 10 lines or so, go in-game, talk, look at server_log.txt and see which number appeared last - the crash was caused by the code between that number and the next.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)