Error Trapping
#1

Hi.

I have a 20000 line script. It uses MySQL.

Every now and then, the server crashes. Sometimes when players are online, sometimes not. Sometimes frequently, sometimes not. The script is based around the time of day. For example, certain things happen at certain times of the day. I tried logging the game time every two minutes, to see if it was a certain time of day that the game was crashing, and it wasn't.

This problem has been in the script for months, and I really don't know what could be causing it, or when the bug was accidentally implemented.

Is there something I can use to trap errors to fix this problem?

Thanks
Reply
#2

bump - I really need to know if PAWN can trap errors or not, I can't find much about it...
Reply
#3

Yes, i know this problem. MySQL don't know the symbols formated by ALT+ NUMPAD

Example: ® © Ђ Ј » Ѕ ¶ Ґ ‘

ETC.

There are 210-250 characters ... Try to find a program with all characters , and do this under /register

pawn Код:
if (strcmp(cmd, "/register", true) ==0 )
    {
      if(IsPlayerConnected(playerid))
      {
        if(gPlayerLogged[playerid] == 1)
            {
                SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "SERVER: You are already logged in.");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new namestring = strfind(sendername, "_", true);
            if(namestring == -1)
            {
                SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Immigration: Your name is not acceptable.");
                SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Hint: Your name must be in the format Firstname_Lastname.");
                Kick(playerid);
                return 1;
            }
/*here put the symbols , like in my e.g.*/  new wrong = strfind(tmppass, "®", true) || strfind(tmppass, "©", true) || strfind(tmppass, "†", true) ||
            strfind(tmppass, "‡", true) || strfind(tmppass, "™", true) || strfind(tmppass, "њ", true) || strfind(tmppass, "№", true)
            || strfind(tmppass, "Ђ", true) || strfind(tmppass, "Ј", true) || strfind(tmppass, "Љ", true);
            if(wrong == 1)
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "You can't use symbols.");
                Kick(playerid);
                return 1;
            }
            else
            {
                GetPlayerName(playerid, sendername, sizeof(sendername));
                //format(string, sizeof(string), "%s.ini", sendername);
                new sqlaccountexists = MySQLCheckAccount(sendername);
                //new File: hFile = fopen(string, io_read);
                if (sqlaccountexists != 0)
                {
                    SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Immigration: There is already a citizen with that name.");
                    //fclose(hFile);
                    return 1;
                }
            new tmppass[64];
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "USAGE: /register [password]");
                    return 1;
                }
                strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
                //Encrypt(tmppass);
                OnPlayerRegister(playerid,tmppass);
            }
        }
        return 1;
    }
I think it's Hard, but another solution i don't know
Reply
#4

That's not the issue... I am asking about PAWN error trapping. try and catch don't work, either.

Oh, and they MySQL thing: It's probably better just to check if the password contains letters and numbers and underscores etc rather than trying to find all the characters that don't work with MySQL.
Reply
#5

Bump, an answer to this would be useful to me, too.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)