SA-MP Forums Archive
String is not getting my name. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: String is not getting my name. (/showthread.php?tid=612541)



String is not getting my name. - Shockey HD - 19.07.2016

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;
}



Re: String is not getting my name. - Sawalha - 19.07.2016

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


Re: String is not getting my name. - Sew_Sumi - 19.07.2016

GetPlayerName will not return anything when called in OnPlayerDisconnect.

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


Re: String is not getting my name. - Shockey HD - 19.07.2016

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