SA-MP Forums Archive
Is this correct code? - 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)
+--- Thread: Is this correct code? (/showthread.php?tid=374491)



Is this correct code? - Crazyboobs - 03.09.2012

Which is correct out of these?

pawn Код:
stock MySQLLoadPlayer(playerid)
{
    new query[634];
    format(query, sizeof(query), "SELECT money, Bank, weed, Condoms, inalcatraz, bowner, bowned, vowned, vowner, vowned2, vowner2, vowned3, vowner3, vowned4, vowner4, vowned5, vowner5 FROM data WHERE user = '%s'", pname);
    mysql_query(query);
    mysql_store_result();
    PlayerInfo[playerid][LoggedIn] = 1;
}
pawn Код:
stock MySQLLoadPlayer(playerid)
{
    new query[634];
    format(query, sizeof(query), "SELECT money, Bank, weed, Condoms, inalcatraz, bowner, bowned, vowned, vowner, vowned2, vowner2, vowned3, vowner3, vowned4, vowner4, vowned5, vowner5 FROM data WHERE user = '%s'", pname);
    mysql_query(query);
    PlayerInfo[playerid][LoggedIn] = 1;
}
mysql_store_result(); is needed?


Re: Is this correct code? - Luke_James - 03.09.2012

Is what your trying to do saving information, or loading it?


Re: Is this correct code? - Crazyboobs - 03.09.2012

loading


Re: Is this correct code? - Camacorn - 03.09.2012

Neither of them is correct. In the code you have shown, it isn't storing the data anywhere. I suggest using sscanf to store the data into the proper variables.