OnPlayerText problem. -
BGMike - 07.11.2011
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 ?
Re: OnPlayerText problem. -
MP2 - 07.11.2011
if(!strlen(text)) return 0;
Put that at the top of OnPlayerText
Re: OnPlayerText problem. -
BGMike - 07.11.2011
Quote:
Originally Posted by MP2
if(!strlen(text)) return 0;
Put that at the top of OnPlayerText
|
Still restarting
Re: OnPlayerText problem. -
Kostas' - 07.11.2011
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
}
Re: OnPlayerText problem. -
BGMike - 07.11.2011
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.
Re: OnPlayerText problem. -
MP2 - 07.11.2011
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;
}
Re: OnPlayerText problem. -
BGMike - 07.11.2011
MP2 what you mean with this '// code' ?
Re: OnPlayerText problem. -
Sascha - 07.11.2011
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
Re: OnPlayerText problem. -
BGMike - 07.11.2011
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" ?
Re: OnPlayerText problem. -
MP2 - 07.11.2011
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.