AwkwardSQL
#4

Quote:

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.

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);
change with

Код:
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));
gName not defined you must use GetPName(playerid) for get player name

Quote:

How to load the player co-ordinates on his first spawn (maybe using my variable FirstSpawn)?

find this lines ( in public LoadStats(playerid) )

Код:
        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]);
Use this codes on public OnPlayerSpawn(playerid). This values 0.0 if user not registered. So you must add extra call for this is first spawn with sql user or new register user. If you want when players died they spawn with same location, use getposition in onplayerdeath btw.
Reply


Messages In This Thread
AwkwardSQL - by x96664 - 24.09.2013, 15:39
Re: AwkwardSQL - by x96664 - 24.09.2013, 16:51
Re: AwkwardSQL - by x96664 - 25.09.2013, 16:18
Re: AwkwardSQL - by maxisaibot - 25.09.2013, 16:39
Re: AwkwardSQL - by x96664 - 25.09.2013, 17:01

Forum Jump:


Users browsing this thread: 1 Guest(s)