SA-MP Forums Archive
Error Trapping - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Error Trapping (/showthread.php?tid=73147)



Error Trapping - 1337pr0 - 13.04.2009

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


Re: Error Trapping - 1337pr0 - 19.04.2009

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


Re: Error Trapping - Danut - 19.04.2009

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


Re: Error Trapping - 1337pr0 - 20.04.2009

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.


Re: Error Trapping - Blacklite - 30.05.2009

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