[MySQL] From StickenKid's plugin to BlueG's plugin
#3

Quote:
Originally Posted by Patrick_
View Post
Well converting from StrickenKid's will be different because r39 threaded and they aren't similar to the old one which I am referring to r6, I suggest you to read this https://sampwiki.blast.hk/wiki/MySQL/R33 and this https://sampforum.blast.hk/showthread.php?tid=337810 those link will help you a lot! so this is the code.

pawn Code:
new
    rCheck[MAX_PLAYERS]; // declare a per-player array/var.

//Under OnPlayerConnect
++ rCheck[playerid];

//Under OnPlayerDisconnect
++ rCheck[playerid];


//Sends a query which will be executed in another thread and calls the callback (if there is one) when the execution is finished.
mysql_tquery(connectionHandle, "SELECT * FROM `characters` WHERE `Activated` = 0 AND `Deletable` = 0 AND `DenialReason` = 'DenialReason' LIMIT 1", "OnCharactersLoad", "ii", playerid, rCheck[playerid]);

forward OnCharactersLoad(playerid, race_check);
public OnCharactersLoad(playerid, race_check)
{
    new
        rows = cache_num_rows();

    if(rCheck[playerid] != race_check) //if the race_check
        return Kick(playerid), printf("Invalid Race Check: rCheck[playerid]: %i - race_check:%i", rCheck[playerid], race_check);

    if(rows) //if rows is more than one, we proceed loading player's status.
    {
        cache_get_field_content(0, "CharacterName", destination, connectionHandle = 1, sizeof(destination));
        //and so on loading
    }
    return true;
}
Why does race_check needed?
Thanks for the explanation, I started converting my (At that moment bugging SQL script) and then I found a backup from a few days ago which I thought I accidentily deleted, so now I'm not going to convert my script anymore because BlueG's might be better (Threaded, faster) but I am used to StrickenKid's and I don't really feel like having to convert a script from ~7K lines... I'll rep you as I do actually understand BlueG's plugin now!

Best regards,
Jesse
Reply


Messages In This Thread
[MySQL] From StickenKid's plugin to BlueG's plugin - by jessejanssen - 14.06.2014, 17:57
Re: [MySQL] From StickenKid's plugin to BlueG's plugin - by Patrick - 14.06.2014, 18:16
Re: [MySQL] From StickenKid's plugin to BlueG's plugin - by jessejanssen - 15.06.2014, 01:20

Forum Jump:


Users browsing this thread: 1 Guest(s)