12.03.2014, 19:03
I am trying to save the player position, but dont know how...
Can anyone help?
Code:
Thanks
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; }