help mysql r7
#1

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!!!!
Reply
#2

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.
Reply
#3

follows the error
Reply
#4

also actualize the pluring
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)