Server crashs whenever I type anything
#1

Uhmm, so. Whenever I turn the server online (linux, hosted in volt-host) and go in-game and type anything (not command) the whole server crashs for unkown reasons. I have all the includes updates, plugins and everything.

But, whenever I go ig and type a command, e.g: /stats, It works. But when I type anything e.g: hi, hello etc

the server crashs.

I also ran Native Checker, but no errors shows up.
Reply
#2

Did you search for the reason under OnPlayerText?

Considering it doesn't crash when using commands, the problem will more or likely be in that area of code.
Reply
#3

I have a feeling that this is the reason for the crash:

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128];
    if(IsPlayerNPC(playerid))return 1;

    if(CurGMX == 2)
    {
        SendClientMessage(playerid, WHITE, "[Error] Server is restarting.");
        return 0;
    }


    if(stringContainsIP(text))
    {
        new string5555[256];
        format(string5555, sizeof(string5555), "%s maybe Server Advertising. [Text: %s]", RemoveUnderScore(playerid), text);
        SendToAdmins(RED, string5555, 0);
        return false;
    }

    if(!strcmp(text, "lol", true))
    {
        if(Player[playerid][Authenticated] == 1)
        {
            if(Player[playerid][RPQuiz] != 1)
            {
               format(string, sizeof(string), "[Auto Jail] %s has been Admin Jailed [Reason: Using \"LOL\" on an IC chat.]", RemoveUnderScore(playerid));
               SendClientMessageToAll(LBLUE, string);
               SendClientMessage(playerid, RED, "Remember: Do NOT use OOC chat terms on an IC chat.");
               Player[playerid][PrisonDuration] = 15*60;
               Player[playerid][PrisonID] = 1;
               AdminActionsLog(string);
               if(IsPlayerInAnyVehicle(playerid))
               {
                   RemovePlayerFromVehicle(playerid);
               }
               ResetPlayerWeaponsEx(playerid);
               SetPlayerInterior(playerid, Prison1Int);
               SetPlayerPos(playerid, Prison1X, Prison1Y, Prison1Z);
               SetPlayerVirtualWorld(playerid, Prison1World);
               return 0;
            }
        }
    }
    else if(!strcmp(text, "rofl", true))
    {
        if(Player[playerid][Authenticated] == 1)
        {
            if(Player[playerid][RPQuiz] != 1)
            {
               format(string, sizeof(string), "[Auto Jail] %s has been Admin Jailed [Reason: Using \"ROFL\" on an IC chat.]", RemoveUnderScore(playerid));
               SendClientMessageToAll(LBLUE, string);
               Player[playerid][PrisonDuration] = 15*60;
               SendClientMessage(playerid, RED, "Remember: Do NOT use OOC chat terms on an IC chat.");
               Player[playerid][PrisonID] = 1;
               AdminActionsLog(string);
               if(IsPlayerInAnyVehicle(playerid))
               {
                   RemovePlayerFromVehicle(playerid);
               }
               ResetPlayerWeaponsEx(playerid);
               SetPlayerInterior(playerid, Prison1Int);
               SetPlayerPos(playerid, Prison1X, Prison1Y, Prison1Z);
               SetPlayerVirtualWorld(playerid, Prison1World);
               return 0;
            }
        }
    }
    else if(!strcmp(text, "<3", true))
    {
        if(Player[playerid][Authenticated] == 1)
        {
            if(Player[playerid][RPQuiz] != 1)
            {
               format(string, sizeof(string), "[Auto Jail] %s has been Admin Jailed [Reason: Using \"<3\" on an IC chat.]", RemoveUnderScore(playerid));
               SendClientMessageToAll(LBLUE, string);
               Player[playerid][PrisonDuration] = 15*60;
               SendClientMessage(playerid, RED, "Remember: Do NOT use OOC chat terms on an IC chat.");
               Player[playerid][PrisonID] = 1;
               AdminActionsLog(string);
               if(IsPlayerInAnyVehicle(playerid))
               {
                   RemovePlayerFromVehicle(playerid);
               }
               ResetPlayerWeaponsEx(playerid);
               SetPlayerInterior(playerid, Prison1Int);
               SetPlayerPos(playerid, Prison1X, Prison1Y, Prison1Z);
               SetPlayerVirtualWorld(playerid, Prison1World);
               return 0;
            }
        }
    }
    else if(!strcmp(text, "noob", true))
    {
        if(Player[playerid][Authenticated] == 1)
        {
            if(Player[playerid][RPQuiz] != 1)
            {
               format(string, sizeof(string), "[Auto Jail] %s has been Admin Jailed [Reason: Using \"NOOB\" on an IC chat.]", RemoveUnderScore(playerid));
               SendClientMessageToAll(LBLUE, string);
               Player[playerid][PrisonDuration] = 15*60;
               SendClientMessage(playerid, RED, "Remember: Do NOT use OOC chat terms on an IC chat.");
               Player[playerid][PrisonID] = 1;
               AdminActionsLog(string);
               if(IsPlayerInAnyVehicle(playerid))
               {
                   RemovePlayerFromVehicle(playerid);
               }
               ResetPlayerWeaponsEx(playerid);
               SetPlayerInterior(playerid, Prison1Int);
               SetPlayerPos(playerid, Prison1X, Prison1Y, Prison1Z);
               SetPlayerVirtualWorld(playerid, Prison1World);
               return 0;
            }
        }
    }
    else if(!strcmp(text, "pmsl", true))
    {
        if(Player[playerid][Authenticated] == 1)
        {
            if(Player[playerid][RPQuiz] != 1)
            {
               format(string, sizeof(string), "[Auto Jail] %s has been Admin Jailed [Reason: Using \"PMSL\" on an IC chat.]", RemoveUnderScore(playerid));
               SendClientMessageToAll(LBLUE, string);
               Player[playerid][PrisonDuration] = 15*60;
               SendClientMessage(playerid, RED, "Remember: Do NOT use OOC chat terms on an IC chat.");
               Player[playerid][PrisonID] = 1;
               AdminActionsLog(string);
               if(IsPlayerInAnyVehicle(playerid))
               {
                   RemovePlayerFromVehicle(playerid);
               }
               ResetPlayerWeaponsEx(playerid);
               SetPlayerInterior(playerid, Prison1Int);
               SetPlayerPos(playerid, Prison1X, Prison1Y, Prison1Z);
               SetPlayerVirtualWorld(playerid, Prison1World);
               return 0;
            }
        }
    }
    else if(!strcmp(text, "xd", true))
    {
        if(Player[playerid][Authenticated] == 1)
        {
            if(Player[playerid][RPQuiz] != 1)
            {
               format(string, sizeof(string), "[Auto Jail] %s has been Admin Jailed [Reason: Using \"XD\" on an IC chat.]", RemoveUnderScore(playerid));
               SendClientMessageToAll(LBLUE, string);
               Player[playerid][PrisonDuration] = 15*60;
               SendClientMessage(playerid, RED, "Remember: Do NOT use OOC chat terms on an IC chat.");
               Player[playerid][PrisonID] = 1;
               AdminActionsLog(string);
               if(IsPlayerInAnyVehicle(playerid))
               {
                   RemovePlayerFromVehicle(playerid);
               }
               ResetPlayerWeaponsEx(playerid);
               SetPlayerInterior(playerid, Prison1Int);
               SetPlayerPos(playerid, Prison1X, Prison1Y, Prison1Z);
               SetPlayerVirtualWorld(playerid, Prison1World);
               return 0;
            }
        }
    }
    else if(!strcmp(text, ":)", true))
    {
        if(Player[playerid][Authenticated] == 1)
        {
            if(Player[playerid][RPQuiz] != 1)
            {
               format(string, sizeof(string), "[Auto Jail] %s has been Admin Jailed [Reason: Using \":)\" on an IC chat.]", RemoveUnderScore(playerid));
               SendClientMessageToAll(LBLUE, string);
               Player[playerid][PrisonDuration] = 15*60;
               SendClientMessage(playerid, RED, "Remember: Do NOT use OOC chat terms on an IC chat.");
               Player[playerid][PrisonID] = 1;
               AdminActionsLog(string);
               if(IsPlayerInAnyVehicle(playerid))
               {
                   RemovePlayerFromVehicle(playerid);
               }
               ResetPlayerWeaponsEx(playerid);
               SetPlayerInterior(playerid, Prison1Int);
               SetPlayerPos(playerid, Prison1X, Prison1Y, Prison1Z);
               SetPlayerVirtualWorld(playerid, Prison1World);
               return 0;
            }
        }
    }
    else if(!strcmp(text, ":(", true))
    {
        if(Player[playerid][Authenticated] == 1)
        {
            if(Player[playerid][RPQuiz] != 1)
            {
               format(string, sizeof(string), "[Auto Jail] %s has been Admin Jailed [Reason: Using \":(\" on an IC chat.]", RemoveUnderScore(playerid));
               SendClientMessageToAll(LBLUE, string);
               Player[playerid][PrisonDuration] = 15*60;
               SendClientMessage(playerid, RED, "Remember: Do NOT use OOC chat terms on an IC chat.");
               Player[playerid][PrisonID] = 1;
               AdminActionsLog(string);
               if(IsPlayerInAnyVehicle(playerid))
               {
                   RemovePlayerFromVehicle(playerid);
               }
               ResetPlayerWeaponsEx(playerid);
               SetPlayerInterior(playerid, Prison1Int);
               SetPlayerPos(playerid, Prison1X, Prison1Y, Prison1Z);
               SetPlayerVirtualWorld(playerid, Prison1World);
               return 0;
            }
        }
    }
    else if(!strcmp(text, ":D", true))
    {
        if(Player[playerid][Authenticated] == 1)
        {
            if(Player[playerid][RPQuiz] != 1)
            {
               format(string, sizeof(string), "[Auto Jail] %s has been Admin Jailed [Reason: Using \":D\" on an IC chat.]", RemoveUnderScore(playerid));
               SendClientMessageToAll(LBLUE, string);
               Player[playerid][PrisonDuration] = 15*60;
               SendClientMessage(playerid, RED, "Remember: Do NOT use OOC chat terms on an IC chat.");
               Player[playerid][PrisonID] = 1;
               AdminActionsLog(string);
               if(IsPlayerInAnyVehicle(playerid))
               {
                   RemovePlayerFromVehicle(playerid);
               }
               ResetPlayerWeaponsEx(playerid);
               SetPlayerInterior(playerid, Prison1Int);
               SetPlayerPos(playerid, Prison1X, Prison1Y, Prison1Z);
               SetPlayerVirtualWorld(playerid, Prison1World);
               return 0;
            }
        }
    }
    else if(!strcmp(text, "D:", true))
    {
        if(Player[playerid][Authenticated] == 1)
        {
            if(Player[playerid][RPQuiz] != 1)
            {
               format(string, sizeof(string), "[Auto Jail] %s has been Admin Jailed [Reason: Using \"D:\" on an IC chat.]", RemoveUnderScore(playerid));
               SendClientMessageToAll(LBLUE, string);
               Player[playerid][PrisonDuration] = 15*60;
               SendClientMessage(playerid, RED, "Remember: Do NOT use OOC chat terms on an IC chat.");
               Player[playerid][PrisonID] = 1;
               AdminActionsLog(string);
               if(IsPlayerInAnyVehicle(playerid))
               {
                   RemovePlayerFromVehicle(playerid);
               }
               ResetPlayerWeaponsEx(playerid);
               SetPlayerInterior(playerid, Prison1Int);
               SetPlayerPos(playerid, Prison1X, Prison1Y, Prison1Z);
               SetPlayerVirtualWorld(playerid, Prison1World);
               return 0;
            }
        }
    }
(This is not the full code, there's a tutorial but I assume It aint needed)
Reply
#4

Other then you're wasting a lot of lines and resources by repeating everything unnecessary i don't see anything wrong.

Show us the function stringContainsIP, does it require a plugin?
Reply
#5

Quote:
Originally Posted by WackoX
Посмотреть сообщение
Other then you're wasting a lot of lines and resources by repeating everything unnecessary i don't see anything wrong.

Show us the function stringContainsIP, does it require a plugin?
pawn Код:
stock stringContainsIP(string[])
{
    new
        dotCount
    ;
    for(new i; string[i] != EOS; ++i)
    {
        if(('0' <= string[i] <= '9') || string[i] == '.' || string[i] == ':')
        {
            if((string[i] == '.') && (string[i + 1] != '.') && ('0' <= string[i - 1] <= '9'))
            {
                ++dotCount;
            }
            continue;
        }
    }
    return (dotCount > 2);
}
Reply
#6

So, is this causing the crash?
Reply
#7

This is causing the crash

Код:
    if(CurGMX == 2)
    {
        SendClientMessage(playerid, WHITE, "[Error] Server is restarting.");
        return 0;
    }
It's restarting the server, your Script is bugged. So any time you type somthing it restarts the server, so I suggest you remove it, any other problems just let me know.
Reply
#8

^_^?
Seriously?, There is no SendRconCommand gmx in the code so there is 0% everytime he types something it will restart check the code before posting.
Reply
#9

There is

pawn Код:
public DoGMX()
{
    SendRconCommand("gmx");
    return 1;
}
Reply
#10

Any help?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)