So there comes the first problem, when player leaves the server the stored values are set to all other players in the database, so when someone logs it will set him the same stats, that the last player who left the server had. Let me just note that it doesn't change the passwords, names and ID's. |
format(query, sizeof(query), "UPDATE players SET Health = %.1f, Armor = %0.f, Interior = %d, VW = %d, Skin = %d, X = %f, Y = %f, Z = %f, A = %f WHERE Name = '%s'", HP, AP, GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid), GetPlayerSkin(playerid), X, Y, Z, A, gName);
format(query, sizeof(query), "UPDATE players SET Health = %.1f, Armor = %0.f, Interior = %d, VW = %d, Skin = %d, X = %f, Y = %f, Z = %f, A = %f WHERE Name = '%s'", HP, AP, GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid), GetPlayerSkin(playerid), X, Y, Z, A, GetPName(playerid));
How to load the player co-ordinates on his first spawn (maybe using my variable FirstSpawn)? |
SetPlayerHealth(playerid, PInfo[playerid][pHealth]); SetPlayerArmour(playerid, PInfo[playerid][pArmor]); SetPlayerInterior(playerid, PInfo[playerid][pInterior]); SetPlayerVirtualWorld(playerid, PInfo[playerid][pVirtualWorld]); SetPlayerSkin(playerid, PInfo[playerid][pSkin]); SetPlayerPos(playerid, PInfo[playerid][pX], PInfo[playerid][pY], PInfo[playerid][pZ]); SetPlayerFacingAngle(playerid, PInfo[playerid][pA]);
find
Код:
format(query, sizeof(query), "UPDATE players SET Health = %.1f, Armor = %0.f, Interior = %d, VW = %d, Skin = %d, X = %f, Y = %f, Z = %f, A = %f WHERE Name = '%s'", HP, AP, GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid), GetPlayerSkin(playerid), X, Y, Z, A, gName); Код:
format(query, sizeof(query), "UPDATE players SET Health = %.1f, Armor = %0.f, Interior = %d, VW = %d, Skin = %d, X = %f, Y = %f, Z = %f, A = %f WHERE Name = '%s'", HP, AP, GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid), GetPlayerSkin(playerid), X, Y, Z, A, GetPName(playerid)); |
new
gName[MAX_PLAYER_NAME], //actually gName is defined there
IMDb,
Registered[MAX_PLAYERS],
Logged[MAX_PLAYERS],
PInfo[MAX_PLAYERS][PlayerInfo];