You need to go through the mysql functions, in order to save the values to the database.
However, if you're lazy, you can make 1 function to push the data to the database, but that's not not the best way to do it. (You would probably update 100 different values just to update 1 and so on)
for example;
PHP код:
CMD:command
{
//dini stuff goes here, lets say this example:
dini_IntSet(file, "level", 0);
dini_IntSet(file, "score", GetPlayerScore(playerid));
dini_IntSet(file, "money", GetPlayerMoney(playerid));
return 1;
}
There is no other option than using the mysql_functions - as they are used to push the data to the database.
Create all tables, columns and so on, then:
PHP код:
CMD:command(playerid, params[])
{
new string[99];
mysql_format(connectionHandle, string, sizeof(string), "UPDATE STATS SET level = 0, score = %d, money = %d WHERE USERNAME = '%e'", GetPlayerScore(playerid), GetPlayerMoney(playerid));
mysql_tquery(connectionHandle, string, "", "");
return 1;
}
if you are selecting data / reading from the database it would be something like this:
PHP код:
CMD:command(playerid, params[])
{
new string[128];
mysql_format(connectionHandle, string, sizeof(string), "Select .....", params here);
mysql_tquery(connectionHandle, string, "LoadData", "d", playerid);
return 1;
}
//then you need to use the cache functions under the Callback the tquery called, assuming you use threaded queries (like in the R39-5 Mysql plugin)
forward LoadData(playerid);
public LoadData(playerid)
{
cache_get_row_count(connectionHandle = 1)
cache_get_field_content_int(row, field_name[], connectionHandle = 1)
cache_get_field_content(row, field_name[], destination[], connectionHandle = 1, max_len = sizeof(destination)
//and so on, read the wiki for the cache functions.
return 1;
}
https://sampwiki.blast.hk/wiki/MySQL/R33#Cache_functions --> Cache functions
Please note that the above was just a very simple example - and there is no way around if you want to save / update data in the database.