SA-MP Forums Archive
MySQL R41-4 Data load help - 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: MySQL R41-4 Data load help (/showthread.php?tid=648519)



MySQL R41-4 Data load help - BaranHyrn - 23.01.2018

Hi my gamemodes script is r5 to r41-4 update last data load problem

Код:
stock GetPlayerDataStr(playerid, sutun[])
{
	new query[160], result[24];
	format(query, sizeof(query), "SELECT `%s` FROM `player` WHERE `name` = '%s'", data, GetPlayerNameEx(playerid));
	mysql_query(Database,query);
	//cache_get_value(playerid,data,result,20);
	return sonuc;
}



Re: MySQL R41-4 Data load help - DobbysGamertag - 23.01.2018

You need to thread the query (you can do it without threading, but i highly recommend you do so):

Here's what you need:

https://sampwiki.blast.hk/wiki/MySQL/R40

Look for:

3.11 cache_get_value_name
3.12 cache_get_value_name_int
3.13 cache_get_value_name_float


There's a few examples on the wiki page i linked you on how to thread queries.


Re: MySQL R41-4 Data load help - BaranHyrn - 24.01.2018

Study you reply but very very lag problem it was

Edit:
Код:
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '82' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '83' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '84' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '85' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '86' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '87' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '88' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '89' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '90' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '91' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '92' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '93' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '94' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '95' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '96' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '97' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '98' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '99' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '100' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '101' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '102' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '103' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '104' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '105' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '106' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '107' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '108' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '109' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '110' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '111' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '112' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '113' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '114' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '115' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '116' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '117' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '118' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '119' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '120' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '121' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '122' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '123' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '124' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '125' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '126' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '127' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '128' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '129' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '130' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '131' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '132' (number of rows: '0')
[22:17:40] [plugins/mysql] cache_get_value_name_int: invalid row index '133' (number of rows: '0')
Код:
stock GetPlayerDataInt(playerid, data[])
{
	new query[160], result;
	new DB_query[256];
	mysql_format(Database, DB_query, sizeof(DB_query),"SELECT `%s` FROM `users` WHERE `name` = '%s'", data, GetPlayerNameEx(playerid));
	mysql_query(Database,query);
    cache_get_value_name_int(playerid,data,result);
	return result;
}
Example:GetPlayerDataInt(playerid,"Money");


Re: MySQL R41-4 Data load help - DobbysGamertag - 25.01.2018

Are you using it in a loop?

You're right so far, but you need to assign it an ID. See mysql_query();

You might also want to add a LIMIT 1 to the end of that query.

pawn Код:
SELECT `%s` FROM `users` WHERE `name` = '%s' LIMIT 1
You're getting it, stick at it.


Re: MySQL R41-4 Data load help - BaranHyrn - 25.01.2018

I could not , I have this function is i use it to draw data for example;

Код:
	if(strcmp(cmd, "/myscore", true) == 0)
	{
	new string[128];
	format(string,sizeof(string),"My score is %d",GetPlayerDataInt(playerid,"score"));
	SendClientMessage(playerid,string);
	return 1;
	}
I did not do it Do not update to r5 to r41-4 it works extremely slowly the data is getting smooth but very very slowly and is creating the above error list The function example used in the r5 version is shown below;

Код:
stock GetPlayerDataInt(playerid, data[])
{
	new Query[160], result;
	format(Query, sizeof(Query), "SELECT `%s` FROM `users` WHERE `name` = '%s'", data, GetPlayerNameEx(playerid));
	mysql_query(Query);
	mysql_store_result();
	result = mysql_fetch_int();
	mysql_free_result();
	return sonuc;
}