SA-MP Forums Archive
SQL doesnt load first letter. - 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: SQL doesnt load first letter. (/showthread.php?tid=489901)



SQL doesnt load first letter. - anou1 - 24.01.2014

Hi,

I got a problem when I try to recover the reason if a player is banned.
In the reason, it gives me the good reason, but It doen't retrieves the first letter of the reason.

For exemple if the reason is "this is a test" it will show " his is a test"
I can't find why. Anyone got an idea ?

Код:
public OnAccountLoad(playerid)
{
	pInfo[playerid][RaisonBan] = cache_get_field_content(0, "RaisonBan", pInfo[playerid][RaisonBan], 129, 129);
Код:
public OnPlayerSpawn(playerid)
{
	if(pInfo[playerid][Bannis] == 1)
	{
		new string[128];
		format(string, sizeof(string), "Vous кtes bannis du serveur. Raison: %s", pInfo[playerid][RaisonBan]);
		printf("%s", pInfo[playerid][RaisonBan]);
		SendClientMessage(playerid, Rouge, string);
		SetTimerEx("KickJoueur", 1000, 0, "d", playerid);
	}	
	return 1;
}
In the server log I got: "[12:38:07] estosorus" so the first letter "t" is missing too.
In mysql log :
Код:
[12:38:07] [DEBUG] cache_get_field_content - row: 0, field_name: "RaisonBan", connection: 129, max_len: 129
[12:38:07] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "RaisonBan", data: "testosorus"
[12:38:07] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
So the reason is good there but not after.


Re: SQL doesnt load first letter. - Misiur - 24.01.2014

pawn Код:
//change
pInfo[playerid][RaisonBan] = cache_get_field_content(0, "RaisonBan", pInfo[playerid][RaisonBan], 129, 129);
//to
cache_get_field_content(0, "RaisonBan", pInfo[playerid][RaisonBan], 129, 129);
Explanation: When you use assignment, your 0 cell is overwritten with result of cache_get_field_content - 0, or 1 - this is not printable character, and your first element in string is either empty (0 == EOS), or has corrupted first character

(also, are you sure your connection handle is 129?)


Re : SQL doesnt load first letter. - anou1 - 24.01.2014

Thank you guy for the explanations for the cell !

I did this:

cache_get_field_content(0, "RaisonBan", pInfo[playerid][RaisonBan], mysql, 129);

Now it works.

And you were right, my connection handle wasnt 129