[How-To] Fix All Current MySQL Issues

Status
Not open for further replies.

Doc

Valued Member!
Ok, these threads appear every day and noones seems to be able to find my original post on how to fix these. If you have any MySQL errors relating to unknown column 'MaxDamage' or a problem with a decimal value '', etc. Then you need to follow these simple instructions

replace pSpawn with this:

Code:
BEGIN
    DECLARE bSpawned        TINYINT(1) DEFAULT 0;
    DECLARE iLID                INT DEFAULT 0;
 
    WHILE (bSpawned = 0) DO
 
        SET iLID = LAST_INSERT_ID();
 
        INSERT INTO object_data (ObjectUID, Instance, Classname, Damage, CharacterID, Worldspace, Inventory, Hitpoints, Fuel, Datestamp)
        SELECT ot.ObjectUID, '1', ot.Classname, ot.Damage, '0', ot.Worldspace, '[]', ot.Hitpoints, '0.05', SYSDATE()
            FROM (SELECT oc.Classname, oc.Chance, oc.MaxNum, oc.Damage, oc.Hitpoints, os.ObjectUID, os.Worldspace
                FROM object_classes AS oc
                INNER JOIN object_spawns AS os
                ON oc.Classname = os.Classname
                ORDER BY RAND()) AS ot
            WHERE NOT EXISTS (SELECT od.ObjectUID
                            FROM object_data AS od
                            WHERE ot.ObjectUID = od.ObjectUID)
            AND fGetClassCount(ot.Classname) < ot.MaxNum
            AND fGetSpawnFromChance(ot.Chance) = 1
            LIMIT 1;
     
            IF (LAST_INSERT_ID() <> iLID) THEN
                SET bSpawned = 1;
            END IF;
     
    END WHILE;
END

and pCleaupOOB with this:

Code:
BEGIN
 
    DECLARE intLineCount    INT DEFAULT 0;
    DECLARE intDummyCount    INT DEFAULT 0;
    DECLARE intDoLine            INT DEFAULT 0;
    DECLARE intWest                INT DEFAULT 0;
    DECLARE intNorth            INT DEFAULT 0;
 
    SELECT COUNT(*)
        INTO intLineCount
        FROM object_data;
 
    SELECT COUNT(*)
        INTO intDummyCount
        FROM object_data
        WHERE Classname = 'dummy';
 
    WHILE (intLineCount > intDummyCount) DO
   
        SET intDoLine = intLineCount - 1;
 
        SELECT ObjectUID, Worldspace
            INTO @rsObjectUID, @rsWorldspace
            FROM object_data
            LIMIT intDoLine, 1;
 
        SELECT REPLACE(@rsWorldspace, '[', '') INTO @rsWorldspace;
        SELECT REPLACE(@rsWorldspace, ']', '') INTO @rsWorldspace;
        SELECT REPLACE(SUBSTRING(SUBSTRING_INDEX(@rsWorldspace, ',', 2), LENGTH(SUBSTRING_INDEX(@rsWorldspace, ',', 2 -1)) + 1), ',', '') INTO @West;
        SELECT REPLACE(SUBSTRING(SUBSTRING_INDEX(@rsWorldspace, ',', 3), LENGTH(SUBSTRING_INDEX(@rsWorldspace, ',', 3 -1)) + 1), ',', '') INTO @North;
 
        SELECT INSTR(@West, '-') INTO intWest;
        SELECT INSTR(@North, '-') INTO intNorth;
 
        IF (intNorth = 0) THEN
            IF (@North = NULL) THEN
                SET @North = '';
                SELECT CONVERT(@North, DECIMAL(16,8)) INTO intNorth;
            END IF;
            IF (@North != NULL) THEN
                SELECT CONVERT(@North, DECIMAL(16,8)) INTO intNorth;
            END IF;
        END IF;
 
        IF (intWest > 0 OR intNorth > 15360) THEN
            DELETE FROM object_data
                WHERE ObjectUID = @rsObjectUID;
        END IF;
       
        SET intLineCount = intLineCount - 1;
 
    END WHILE;
 
END
 
Can't tell if this would fix anything for me as when I changed it to this I had login issues (get stuck at loading screen). Reverted it and it's loading fine now. No issue could be seen in RPT or hive logs and nothing popped up in the server console.
 
Changing this would not affect any login issues etc. It is purely the function for spawning vehicles before the server starts
 
Right, I agree with you but for whatever reason with the new script no one can log in (stuck at loading screen). Is it maybe conflicting with pbmain (I changed the 11 to 60 to spawn more vehicles)? Or would that not matter either?
 
I open up the pspawn and pcleanoob and paste the text you have in the beginning of this thread (overwriting/deleting the old text that those functions had originally).
 
Interesting - When you say open up, I assume with Navicat or similar?

There is no direct reason why changing these would affect your login at all. Perhaps you're starting your server incorrectly, or you don't edit these correctly which causes an error that prevents MySQL launching before the server starts?
 
Yes with Navicat.

Right, I have no idea why it's not running like what you prescribed it to be. I'm starting my servers per the video tutorial and copy/paste is a simple function I am capable of executing properly. Have you changed your pMain number value? The default is 11 I think and I've changed mine to 60. I wonder if that might have anything to do with it or nothing at all.

Otherwise, I have no idea why this would be causing me to have this issue. I'm a real competent individual so following directions isn't hard for me to do when it comes to the technical things. In the next day or two I will retry copying your script and see if it continues to have errors.

Also let me clarify...I can run the server the first time but on server restarts it begins these issues. Most of the times they crop up when someone saves the vehicle with new gear put in or taken out.
 
If it is fine with you Doc, I will push these to GitHub. Sorry for not being able to fix the problem(s) myself as my computer is completly busted and I am forced to work from my Galaxy S3...

*Before I push I need your permission Doc.*
 
You have my complete permission pwnoz0r. All I did was tweak a few lines in your code to allow NULL values to be converted to decimal by setting them as a string first :)
 
Yes with Navicat.

Right, I have no idea why it's not running like what you prescribed it to be. I'm starting my servers per the video tutorial and copy/paste is a simple function I am capable of executing properly. Have you changed your pMain number value? The default is 11 I think and I've changed mine to 60. I wonder if that might have anything to do with it or nothing at all.

Otherwise, I have no idea why this would be causing me to have this issue. I'm a real competent individual so following directions isn't hard for me to do when it comes to the technical things. In the next day or two I will retry copying your script and see if it continues to have errors.

Also let me clarify...I can run the server the first time but on server restarts it begins these issues. Most of the times they crop up when someone saves the vehicle with new gear put in or taken out.

I am free on Wednesday - if you want you can add me on skype so you can share your screen or you can use Team Viewer and I will help you get this fixed
 
*Meanwhile on a Galaxy S3 I will try and push this now. Windows Emulators PCoIP is horrid.
 
Status
Not open for further replies.
Back
Top