MySQL problem.
#4

One more question about loading... I'm has edited this loading system, so I suppose t remove sscanf, but how?

Код:
forward LoadPlayer(playerid);
public LoadPlayer(playerid)
{
	new fetch[ 256 ], tmpa;
	format(query, 256, "SELECT * FROM `"TABLENAME"` WHERE id = '%i'", pInfo[playerid][pId]);
	mysql_query(query);
	mysql_store_result();
	mysql_retrieve_row();

	mysql_fetch_field_row(fetch,"Lygis");
	new tmplygis;
	sscanf(fetch, "i", tmplygis);
	SetPlayerScore(playerid, tmplygis);
	mysql_fetch_field_row(fetch,"Wanted");
	new tmpwanted;
	sscanf(fetch, "i", tmpwanted);
	SetPlayerWantedLevel(playerid, tmpwanted);
	mysql_fetch_field_row(fetch,"Pinigai");
	ResetPlayerMoney(playerid);
	new tmpmoney;
	sscanf(fetch, "i", tmpmoney);
	GivePlayerMoney(playerid, tmpmoney);
	mysql_fetch_field_row(fetch,"World");
	new tmpworld;
	sscanf(fetch, "i", tmpworld);
	SetPlayerVirtualWorld(playerid, tmpworld);
	mysql_fetch_field_row(fetch,"Skin");
	new tmpskin;
	sscanf(fetch, "i", tmpskin);
	SetPlayerSkin(playerid, tmpskin);
	mysql_fetch_field_row(fetch,"Admin");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", pInfo[playerid][admin]);
	mysql_fetch_field_row(fetch,"Bankas");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][bankas]);
	mysql_fetch_field_row(fetch,"Uniforma");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][uniforma]);
	mysql_fetch_field_row(fetch,"Uzdarbis");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][uzdarbis]);
	mysql_fetch_field_row(fetch,"VIPL");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][vipl]);
	mysql_fetch_field_row(fetch,"Kalejimas");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][klaikas]);
	mysql_fetch_field_row(fetch,"Exp");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", pInfo[playerid][exp]);
	mysql_fetch_field_row(fetch,"VIP");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][vip]);
	mysql_fetch_field_row(fetch,"Telefonas");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][tel]);
	mysql_fetch_field_row(fetch,"THealth");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][telhealth]);
	mysql_fetch_field_row(fetch,"Saskaita");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][saskaita]);
	mysql_fetch_field_row(fetch,"Tinklas");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][tinklas]);
	mysql_fetch_field_row(fetch,"Papildymas");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][papildymas]);
	mysql_fetch_field_row(playerDB[playerid][priezastis],"Priezastis");
	mysql_fetch_field_row(playerDB[playerid][dpriezastis],"dPriezastis");
	mysql_fetch_field_row(fetch,"Spec");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][spec]);
	mysql_fetch_field_row(fetch,"Ispejimai");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][ispejimai]);
	mysql_fetch_field_row(fetch,"dIspejimai");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][dispejimai]);
	mysql_fetch_field_row(fetch,"Direktorius");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][direktorius]);
	mysql_fetch_field_row(fetch,"Prangas");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][rangas]);
	mysql_fetch_field_row(fetch,"Uzraktai");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", MaxVehicles[playerid]);
	mysql_fetch_field_row(fetch,"Ziebtuvelis");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][ziebtuvelis]);
	mysql_fetch_field_row(fetch,"Cigaretes");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][cigaretes]);
	mysql_fetch_field_row(fetch,"Namai");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", MaxHouses[playerid]);
	mysql_fetch_field_row(fetch,"Surakintas");
	sscanf(fetch, "i", tmpa);
	sscanf(fetch, "i", playerDB[playerid][surakintas]);
	mysql_fetch_field_row(fetch,"Teises");
	new tmpteises;
	sscanf(fetch, "i", tmpteises);
	sscanf(fetch, "i", playerDB[playerid][teises]);
	mysql_fetch_field_row(fetch,"MTeises");
	new tmpmteises;
	sscanf(fetch, "i", tmpmteises);
	sscanf(fetch, "i", playerDB[playerid][mteises]);
	mysql_fetch_field_row(fetch,"GPS");
	new tmpgps;
	sscanf(fetch, "i", tmpgps);
	if (tmpgps) playerDB[playerid][gps] = true;
	mysql_fetch_field_row(fetch,"Bankok");
	new tmpbankok;
	sscanf(fetch, "i", tmpbankok);
	if (tmpbankok) playerDB[playerid][bankok] = true;
	mysql_fetch_field_row(fetch,"Uniformed");
	new tmpuniformed;
	sscanf(fetch, "i", tmpuniformed);
	if (tmpuniformed) playerDB[playerid][uniformed] = true;
	mysql_fetch_field_row(fetch,"Pakrovejas");
	new tmppakrovejas;
	sscanf(fetch, "i", tmppakrovejas);
	if (tmppakrovejas) playerDB[playerid][pakrovejas] = true;
	mysql_fetch_field_row(fetch,"Apakrovejas");
	new tmpapakrovejas;
	sscanf(fetch, "i", tmpapakrovejas);
	if (tmpapakrovejas) playerDB[playerid][apakrovejas] = true;
	mysql_fetch_field_row(fetch,"MTeorija");
	new tmpmteorija;
	sscanf(fetch, "i", tmpmteorija);
	if (tmpmteorija) playerDB[playerid][mteorija] = true;
	mysql_fetch_field_row(fetch,"MMTeorija");
	new tmpmmteorija;
	sscanf(fetch, "i", tmpmmteorija);
	if (tmpmmteorija) playerDB[playerid][mmteorija] = true;
	mysql_free_result();
}
How I have to load veriables correctly?
Reply


Messages In This Thread
MySQL problem. - by Tomejus - 28.12.2010, 07:45
Re: MySQL problem. - by armyoftwo - 28.12.2010, 08:37
Re: MySQL problem. - by Tomejus - 28.12.2010, 09:14
Re: MySQL problem. - by Tomejus - 28.12.2010, 09:23
Re: MySQL problem. - by _rAped - 30.12.2010, 02:38
Re: MySQL problem. - by Tomejus - 30.12.2010, 03:04
Re: MySQL problem. - by _rAped - 30.12.2010, 03:06
Re: MySQL problem. - by Tomejus - 02.01.2011, 00:52

Forum Jump:


Users browsing this thread: 1 Guest(s)