AwkwardSQL
#1

<Moved to a new topic>
Reply
#2

Bump.
Reply
#3

Bump! I bump my post because I don't want to create a whole new topic as many people there do/
Reply
#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
#5

Quote:
Originally Posted by maxisaibot
Посмотреть сообщение
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));
Okay, thank you for the response, I will try it and tell you the result.

Edit:
pawn Код:
new
    gName[MAX_PLAYER_NAME], //actually gName is defined there
    IMDb,
    Registered[MAX_PLAYERS],
    Logged[MAX_PLAYERS],
    PInfo[MAX_PLAYERS][PlayerInfo];
And it's not the problem its still doing the same thing.

If I add this in the OnPlayerSpawn callback it will spawn me everytime when I die at the stored position.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)