Converting? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Server (
https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (
https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Converting? (
/showthread.php?tid=475160)
Converting? -
logoster - 11.11.2013
ok, so i just recently changed hosts, and ive always used mysql r5, however, it just wont run on my new host, while mysql r7 does, so what im wondering, is does anyone know of a tutorial on converting from mysqlr5 (mysql_query) to the new function, (mysql_fucntion_query)?, or mabey someone could just tell me in this thread?
also, here's my setlevel cmd (ill convert it, then ill learn how from there how to convert everything else)
pawn Код:
CMD:setlevel(playerid,params[])
{
new Query[128];
new SetLevel[200];
format(Query,sizeof(Query),"SELECT * FROM `Users` WHERE `Username` = '%s' AND `Alevel` = '10'",GetName(playerid));
mysql_query(Query);
format(SetLevel,sizeof(SetLevel),"INSERT INTO `Users` WHERE `Username` = '%s' AND `Alevel` = '%s'",GetName(playerid),params);
mysql_query(SetLevel);
return 1;
}
Re: Converting? -
Konstantinos - 11.11.2013
Yes, here's a really great tutorial:
https://sampforum.blast.hk/showthread.php?tid=337810
MySQL R34 is out and I'd recommend you to use it. Though, R7 is fine as well since it uses threaded queries.
Re: Converting? -
logoster - 11.11.2013
Quote:
Originally Posted by Konstantinos
|
ive seen that one already, and i dont understand it
Re: Converting? -
Camacorn - 11.11.2013
You do not need to call the query in the command itself. Just create a SaveStats function, and then set their level variable to the new variable, and call the SaveStats function itself.
Ex. PInfo[playerid][ALevel] = level; SaveStats(playerid);
Took the liberty of creating a simple SaveStats function using MySQL R7:
Код:
forward SendQuery();
public SendQuery() return 1;
stock SaveStats(playerid)
{
new query[90];
format(query,sizeof(query),"UPDATE `Accounts` SET `ALevel` = '%i' WHERE `Username` = '%s'",
PInfo[playerid][ALevel],
GetName(playerid));
mysql_function_query(MySQL, query, false, "SendQuery", "");
return 1;
}