[Help]Weird Error
#1

I got some weird error when I'm in the game and type anything.

My samp-server.exe crashes.
I don't know why?
Can it be from something I made in script or what?
Reply
#2

Show some code plz it will probably be something in your script. ie, if it crashes when you write something show onplayertext.
Reply
#3

Quote:
Originally Posted by iggy1
Посмотреть сообщение
Show some code plz it will probably be something in your script. ie, if it crashes when you write something show onplayertext.
'Chea, and I thought that problem could be my OnPlayerText callback...

Here it is:
pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128];
    format( string, sizeof( string ), "%s says [%s Accent]:  %s", UnderscoreToSpaceName( playerid ), Player[playerid][Accent], text);
    NearByMessage( playerid, COLOR_WHITE, string);
    return 0;
}
I get message on my screen and then in a few seconds I see: Server Restart...
Reply
#4

show us all functions that are in OnPlayer text

like nearByMessage Underscoretospacename
that ones
Reply
#5

LOL I forgot to add that

So this is NearByMessage:
pawn Код:
public NearByMessage( playerid, colour, string[])
{
    new Float: PlayerX, Float: PlayerY, Float: PlayerZ;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnectedEx( i ) && IsPlayerSpawned( playerid ) )
           {
               GetPlayerPos( playerid, PlayerX, PlayerY, PlayerZ);
               if(IsPlayerInRangeOfPoint(i, 12, PlayerX, PlayerY, PlayerZ) )
               {
                if(GetPlayerVirtualWorld( playerid ) == GetPlayerVirtualWorld( i ) && GetPlayerInterior( playerid ) == GetPlayerInterior( i ) )
                {
                    SendClientMessage(i, colour, string);
                }
            }
        }
    }
    return true;
}
And this is UnderscoreToSpaceName:
pawn Код:
stock UnderscoreToSpaceName( playerid )
{
    new Name[ MAX_PLAYER_NAME ];
    if( IsPlayerConnected( playerid ) )
    {
        GetPlayerName( playerid, Name, sizeof( Name ) );
    }
    else
    {
        Name = "Disconnected/Nothing";
    }
    for(new z = 0; z < MAX_PLAYER_NAME; z++) if(Name[z] == '_') Name[z] = ' ';
    return Name;
}
Reply
#6

What is the accent you speak in?
Might be some special characters which crashes..
I'm not sure though, just an assumption.
Reply
#7

Quote:
Originally Posted by LarzI
Посмотреть сообщение
What is the accent you speak in?
Might be some special characters which crashes..
I'm not sure though, just an assumption.
I tryed that already...
I delete my accent in userfiles and it's still the same...
I tryed to comment the OnPlayerText and still crashes... :S
Reply
#8

Put prints on the bottom in every callback (OnGameModeInit, OnPlayerConnect, OnPlayerRequestClass, OnPlayerRequestSpawn, OnPlayerSpawn etc.) then you'll see which message which doesn't get printed, and then you know that the problem is caused by something after the last message which got printed.

Example:

You put
pawn Код:
print("OnGameModeInit - clear");
for each callback, then if the log says
Код:
OnGameModeInit - clear
OnPlayerConnect - clear
OnPlayerRequestClass - clear
OnPlayerRequestSpawn - clear
Then you know that the problem is caused by what comes after OnPlayerRequestSpawn, which is OnPlayerSpawn.
Reply
#9

Quote:
Originally Posted by LarzI
Посмотреть сообщение
Put prints on the bottom in every callback (OnGameModeInit, OnPlayerConnect, OnPlayerRequestClass, OnPlayerRequestSpawn, OnPlayerSpawn etc.) then you'll see which message which doesn't get printed, and then you know that the problem is caused by something after the last message which got printed.

Example:

You put
pawn Код:
print("OnGameModeInit - clear");
for each callback, then if the log says
Код:
OnGameModeInit - clear
OnPlayerConnect - clear
OnPlayerRequestClass - clear
OnPlayerRequestSpawn - clear
Then you know that the problem is caused by what comes after OnPlayerRequestSpawn, which is OnPlayerSpawn.
LOL That was a GREAT Idea!
Thanks mate!!! it was a problem in my OnGameModeInit

I made a IC log so when I write something IG it writes to my IC log....

And can I ask you for one more help
I made command accent and when i someone makes eg. /accent American
it should be writen in userdata and when he writes something, in chat should be like Mark_Krestic says[American accent]: ......

This is my accent command:
pawn Код:
command(accent, playerid, params[])
{
    new accent[128], string[ 128 ];
    if (isnull(params))
        {
        return SendClientMessage(playerid, COLOR_WHITE, "[INFO]: /accent [language]");
        }
    else
    {
        if(IsPlayerSpawned( playerid ) )
        {
            if(strlen(accent) >= 1 && strlen(accent) < 15)
            {
                format( Player[playerid][Accent], 128, "%s", accent);
                format( string, sizeof( string ), "You are now talking in the %s accent!", accent);
                SendClientMessage( playerid, COLOR_WHITE, string);
            }
            else
            {
                SendClientMessage( playerid, COLOR_WHITE, "I don't think an accent is more than 15 characters, or less than 1." );
            }
        }
        else
        {
            SendClientMessage( playerid, COLOR_WHITE, "You're not spawned." );
        }
    }
    return true;
}
But when i make that command it says: "I don't think an accent is more than 15 characters, or less than 1." every time....
Reply
#10

Quote:
Originally Posted by Alex_Valde
Посмотреть сообщение
LOL That was a GREAT Idea!
Thanks mate!!! it was a problem in my OnGameModeInit

I made a IC log so when I write something IG it writes to my IC log....

And can I ask you for one more help
I made command accent and when i someone makes eg. /accent American
it should be writen in userdata and when he writes something, in chat should be like Mark_Krestic says[American accent]: ......

This is my accent command:
pawn Код:
command(accent, playerid, params[])
{
    new accent[128], string[ 128 ];
    if (isnull(params))
        {
        return SendClientMessage(playerid, COLOR_WHITE, "[INFO]: /accent [language]");
        }
    else
    {
        if(IsPlayerSpawned( playerid ) )
        {
            if(strlen(accent) >= 1 && strlen(accent) < 15)
            {
                format( Player[playerid][Accent], 128, "%s", accent);
                format( string, sizeof( string ), "You are now talking in the %s accent!", accent);
                SendClientMessage( playerid, COLOR_WHITE, string);
            }
            else
            {
                SendClientMessage( playerid, COLOR_WHITE, "I don't think an accent is more than 15 characters, or less than 1." );
            }
        }
        else
        {
            SendClientMessage( playerid, COLOR_WHITE, "You're not spawned." );
        }
    }
    return true;
}
But when i make that command it says: "I don't think an accent is more than 15 characters, or less than 1." every time....
Typical thing to do wrong.
You never assign accent to anything, which means it's lenght is 0.

pawn Код:
command(accent, playerid, params[])
{
    new string[ 128 ];
    if (isnull(params))
        return SendClientMessage(playerid, COLOR_WHITE, "[INFO]: /accent [language]");
    if(IsPlayerSpawned( playerid ) )
        return SendClientMessage( playerid, COLOR_WHITE, "You're not spawned." );
       
    if(strlen(params) < 1 && strlen(params) > 15)
        return SendClientMessage( playerid, COLOR_WHITE, "I don't think an accent is more than 15 characters, or less than 1." );

    strmid(Player[playerid][Accent], params, 0, 127); //inserts params[0-127] (params[128]) into your Accent variable.
    format( string, sizeof( string ), "You are now talking in the %s accent!", accent);
    SendClientMessage( playerid, COLOR_WHITE, string);
    return true;
}

Try that ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)