String is not getting my name.
#1

Whenever I disconnect, my stats do not save.


I don't see why they wouldn't especially when I dont get a SQL error.

My SQL debug:

Код:
[04:29:28] CMySQLHandler::Query(UPDATE accounts SET Level=5, Cash=0, bank=0, pX=-931.063110, pY=-502.347808, pZ=25.960937, FAngle=0.000000,pInterior=0, pVW=280,Skin=70 WHERE Username = '') - Successfully executed.

[04:29:28] >> mysql_query( Connection handle: 1 )
Heres the code:

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(pData[playerid][LoggedIn] == 1)
    {
        new pLevel = pData[playerid][Level];
        new pCash = pData[playerid][Cash];
        new pBank = pData[playerid][Bank];
        new pInterior = GetPlayerInterior(playerid);
        new pVirtualWorld = GetPlayerVirtualWorld(playerid);
        new PlayersSkin = pData[playerid][pSkin];
        new Float: f_PlayerPos[3];
        GetPlayerPos(playerid, f_PlayerPos[0], f_PlayerPos[1], f_PlayerPos[2]);
        new query[500], pname[32];
        GetPlayerName(playerid, pname, 24);
        format(query, sizeof(query), "UPDATE accounts SET Level=%d, Cash=%d, bank=%d, pX=%f, pY=%f, pZ=%f, FAngle=%f,pInterior=%d, pVW=%d,Skin=%d WHERE Username = '%s'", pLevel, pCash, pBank,f_PlayerPos[0], f_PlayerPos[1], f_PlayerPos[2], pInterior,pVirtualWorld,PlayersSkin,pname);
        mysql_query(query);
        GetWeapons(playerid);

    }
    return 1;
}
Reply
#2

you forgot the facing angle variable before pInterior and after f_PlayerPos[2]
Reply
#3

GetPlayerName will not return anything when called in OnPlayerDisconnect.

You need to store the name as a string in the script when they connect.
Reply
#4

Quote:
Originally Posted by Sawalha
Посмотреть сообщение
you forgot the facing angle variable before pInterior and after f_PlayerPos[2]
Shit, This was it. Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)