Mysql data keep returning 0
#1

All this data shows up as 0 when its supposed to have a number and has one in the mysql table.


Код:
public OnLoadCharacter(playerid, charid) {
	new id_string[128];
	new rows,fields;
	cache_get_data(rows,fields);
	
	cache_get_row(0, 16, id_string);
	SetPVarInt(playerid, "SkinID", strval(id_string));
	
	cache_get_row(0, 3, id_string);
	SetPVarInt(playerid, "Money", strval(id_string));
	
	cache_get_row(0, 5, id_string);
	SetPVarInt(playerid, "Score", strval(id_string));
	
	cache_get_row(0, 7, id_string);
	SetPVarInt(playerid, "Kills", strval(id_string));
	
	cache_get_row(0, 6, id_string);
	SetPVarInt(playerid, "Deaths", strval(id_string));
	
	cache_get_row(0, 12, id_string);
	SetPVarInt(playerid, "Age", strval(id_string));
	
	cache_get_row(0, 13, id_string);
	SetPVarInt(playerid, "Sex", strval(id_string));
	
	new X,Y,Z;
	cache_get_row(0, 8, id_string);
	X = strval(id_string);
	
	cache_get_row(0, 9, id_string);
	Y = strval(id_string);
	
	cache_get_row(0, 10, id_string);
	Z = strval(id_string);
	
	cache_get_row(0, 15, id_string);
	SetPVarInt(playerid, "VW", strval(id_string));
	
	cache_get_row(0, 1, id_string);
	new name[128], msg[128];
	name = id_string;
	SetPVarString(playerid, "CharacterName", name);
	SetPlayerName(playerid, name);
	format(msg, sizeof(msg), "Age %d | Sex %d | Money %d | Username %s", GetPVarInt(playerid, "Age"), GetPVarInt(playerid, "Sex"), GetPVarInt(playerid, "Money"), name);
	SendClientMessage(playerid, COLOR_RED, msg);
	SetSpawnInfo(playerid, 0, GetPVarInt(playerid, "SkinID"), X, Y, Z, GetPVarInt(playerid,"FacingAngle"),0,0,0,0,0,0);
	SpawnPlayer(playerid);
	
	return 1;
}
Reply
#2

Open the SQL log, look for errors and post them if there are any
Reply
#3

Код:
StartCB("OnAccountCheck");Log("21:52:10","CMySQLResult::GetRowDataByName",2,"field not found (\"ID\")",0);
Log("21:52:10","cache_get_field_content_int",1,"invalid datatype",0);
EndCB();StartCB("OnLoadCharacter");Log("21:52:13","CMySQLResult::GetRowData",2,"invalid row ('0') or field index ('11')",0);
Log("21:52:13","CMySQLResult::GetRowData",2,"invalid row ('0') or field index ('12')",0);
Log("21:52:13","CMySQLResult::GetRowDataByName()",1,"invalid row index ('1')",0);
Thats all I got, I fixed the other numbers not giving the correct info. The username now is being set to Null

Код:
public OnLoadCharacter(playerid, charid) {
	new id_string[128];
	new rows,fields;
	cache_get_data(rows,fields);
	
	cache_get_row(0, 0, id_string);
	SetPVarInt(playerid, "Money", strval(id_string));
	cache_get_field_name(0, id_string);
	printf("Test: '%s'", id_string);
	
	
	cache_get_row(0, 1, id_string);
	SetPVarInt(playerid, "Score", strval(id_string));
	
	
	cache_get_row(0, 2, id_string);
	SetPVarInt(playerid, "Deaths", strval(id_string));
	
	
	cache_get_row(0, 3, id_string);
	SetPVarInt(playerid, "Kills", strval(id_string));
	
	new X,Y,Z;
	cache_get_row(0, 4, id_string);
	X = strval(id_string);
	
	cache_get_row(0, 5, id_string);
	Y = strval(id_string);
	
	
	cache_get_row(0, 6, id_string);
	Z = strval(id_string);
	
	cache_get_row(0, 7, id_string);
	SetPVarInt(playerid, "FacingAngle", strval(id_string));
	
	cache_get_row(0, 8, id_string);
	SetPVarInt(playerid, "Interior", strval(id_string));
	
	cache_get_row(0, 9, id_string);
	SetPVarInt(playerid, "Age", strval(id_string));
	
	cache_get_row(0, 10, id_string);
	SetPVarInt(playerid, "Sex", strval(id_string));
	
	cache_get_row(0, 11, id_string);
	SetPVarInt(playerid, "VW", strval(id_string));
	
	cache_get_row(0, 12, id_string);
	SetPVarInt(playerid, "SkinID", strval(id_string));
	
	cache_get_field_content(0, "username", id_string);
	
	new name[128], msg[128];
	name = id_string;
	SetPVarString(playerid, "CharacterName", id_string);
	SetPlayerName(playerid, name);
	format(msg, sizeof(msg), "Age %d | Sex %d | Money %d | Username %s", GetPVarInt(playerid, "Age"), GetPVarInt(playerid, "Sex"), GetPVarInt(playerid, "Money"), id_string);
	SendClientMessage(playerid, COLOR_RED, msg);
	SetSpawnInfo(playerid, 0, GetPVarInt(playerid, "SkinID"), X, Y, Z, GetPVarInt(playerid,"FacingAngle"),0,0,0,0,0,0);
	SpawnPlayer(playerid);
	
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)