SA-MP Forums Archive
help mysql r7 - 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: help mysql r7 (/showthread.php?tid=575646)



help mysql r7 - capottematias - 28.05.2015

Hello I have an error with the mysql table saved r7 player is all in 0 or empty but name and password

Quote:

forward SaveAccount(playerid);public SaveAccount(playerid)
{
new query[500], pName[33];

GetPlayerPos(playerid, PlayerInfo[playerid][posx], PlayerInfo[playerid][posy], PlayerInfo[playerid][posz]);

format(query, sizeof(query), "UPDATE `user` SET `posX`='%f', `posY`='%f', `posZ`='%f', `angle`='%f', `interiorid`='%f'",
PlayerInfo[playerid][posx],
PlayerInfo[playerid][posy],
PlayerInfo[playerid][posz],
PlayerInfo[playerid][angle],
PlayerInfo[playerid][interiorid]);

format(query, sizeof query, "%s, `adminlvl`='%d', `pass2`='%s', `dinero`='%d', `dinerobank`='%d', `banco`='%d', `movil`='%d', `dni`='%d'",
query,
PlayerInfo[playerid][adminlvl],
PlayerInfo[playerid][pass2],
PlayerInfo[playerid][dinero],
PlayerInfo[playerid][dinerobank],
PlayerInfo[playerid][banco],
PlayerInfo[playerid][movil],
PlayerInfo[playerid][dni]);

format(query, sizeof query, "%s, `busquedad`='%d', `sexo`='%d', `edad`='%d',`skin`='%d',`origen`='%d',`faccion`='% s', `carcel`='%d', `vida`='%d'",
query,
PlayerInfo[playerid][Busqueda],
PlayerInfo[playerid][sexo],
PlayerInfo[playerid][edad],
PlayerInfo[playerid][skin],
PlayerInfo[playerid][origen],
PlayerInfo[playerid][faccion],
PlayerInfo[playerid][carcel],
PlayerInfo[playerid][vida]);

format(query, sizeof query, "%s WHERE `id`='%d' LIMIT 1", query, pName);

mysql_function_query(Conecction, query, true, "OnQueryFinish", "ii", 0, playerid);
return 1;
}
help please come a time that makes this error!!!!


Re: help mysql r7 - Evocator - 28.05.2015

A bit of logic ffs.

Код:
WHERE `id`='%d' LIMIT 1", query, pName
Clearly should be the ID and not the name, also you forgot to use GetPlayerName:

Код:
forward SaveAccount(playerid);
public SaveAccount(playerid)
{
	new 
		query[500], 
		pName[33]
	;

	GetPlayerPos(playerid, PlayerInfo[playerid][posx], PlayerInfo[playerid][posy], PlayerInfo[playerid][posz]);
	GetPlayerName(playerid, pName, MAX_PLAYER_NAME);

	format(query, sizeof(query), "UPDATE `user` SET `posX`='%f', `posY`='%f', `posZ`='%f', `angle`='%f', `interiorid`='%f'",
	PlayerInfo[playerid][posx],
	PlayerInfo[playerid][posy],
	PlayerInfo[playerid][posz],
	PlayerInfo[playerid][angle],
	PlayerInfo[playerid][interiorid]);

	format(query, sizeof query, "%s, `adminlvl`='%d', `pass2`='%s', `dinero`='%d', `dinerobank`='%d', `banco`='%d', `movil`='%d', `dni`='%d'",
	query,
	PlayerInfo[playerid][adminlvl],
	PlayerInfo[playerid][pass2],
	PlayerInfo[playerid][dinero],
	PlayerInfo[playerid][dinerobank],
	PlayerInfo[playerid][banco],
	PlayerInfo[playerid][movil],
	PlayerInfo[playerid][dni]);

	format(query, sizeof query, "%s, `busquedad`='%d', `sexo`='%d', `edad`='%d',`skin`='%d',`origen`='%d',`faccion`='% s', `carcel`='%d', `vida`='%d'",
	query,
	PlayerInfo[playerid][Busqueda],
	PlayerInfo[playerid][sexo],
	PlayerInfo[playerid][edad],
	PlayerInfo[playerid][skin],
	PlayerInfo[playerid][origen],
	PlayerInfo[playerid][faccion],
	PlayerInfo[playerid][carcel],
	PlayerInfo[playerid][vida]);

	format(query, sizeof query, "%s WHERE `id`='%s' LIMIT 1", query, pName);

	mysql_function_query(Conecction, query, true, "OnQueryFinish", "ii", 0, playerid);
	return 1;
}
Also update the plugin.


Respuesta: help mysql r7 - capottematias - 28.05.2015

follows the error


Respuesta: help mysql r7 - capottematias - 28.05.2015

also actualize the pluring