Saving Player Pos mysql
#1

I am trying to save the player position, but dont know how...
Can anyone help?
Code:
Код:
stock SaveStats(playerid)
{
	new query[156];
	new Float:pX, Float:pY, Float:pZ;
	GetPlayerPos(playerid, pX, pY, pZ);
	format(query, sizeof(query), "UPDATE playerdata SET PosX=%f AND PosY=%f AND PosZ=%f WHERE Name='%s'", pX, pY, pZ, GetName(playerid));
	mysql_query(query);
	printf("Player Saved");
	return 1;
}
Код:
stock LoadStats(playerid)
{
	new Query[80];
	format(Query, sizeof(Query), "SELECT * FROM playerdata WHERE Name = '%s'", GetName(playerid));
	mysql_query(Query);
	mysql_store_result();
	mysql_fetch_row_format(Query, "|");
	sscanf(Query, "e<p<|>s[24]s[23]iiiiiii>", PlayerInfo[playerid]);
	mysql_free_result();
	GivePlayerMoney(playerid, PlayerInfo[playerid][Cash]);
	SetPlayerScore(playerid, PlayerInfo[playerid][Level]);
	SetSpawnInfo(playerid, 0, PlayerInfo[playerid][Skin], PlayerInfo[playerid][X], PlayerInfo[playerid][Y], PlayerInfo[playerid][Z], 0, 0, 0, 0, 0, 0, 0);
	SpawnPlayer(playerid);
	return 1;
}
Thanks
Reply


Messages In This Thread
Saving Player Pos mysql - by Blademaster680 - 12.03.2014, 19:03
Re: Saving Player Pos mysql - by Lajko1 - 12.03.2014, 19:13
Re: Saving Player Pos mysql - by Matess - 12.03.2014, 19:16
Re: Saving Player Pos mysql - by Blademaster680 - 12.03.2014, 19:17
Re: Saving Player Pos mysql - by Matess - 12.03.2014, 19:22
Re: Saving Player Pos mysql - by Blademaster680 - 12.03.2014, 19:32
Re: Saving Player Pos mysql - by Matess - 12.03.2014, 19:47
Re: Saving Player Pos mysql - by Blademaster680 - 12.03.2014, 19:53

Forum Jump:


Users browsing this thread: 1 Guest(s)