22.06.2015, 13:52
So I'm trying to learn MySQL, for some reason loading information into player seems to work fine, but updating the data when a player leaves doesn't.
And generally, does anyone know any good place to start learning?
I've read so many tutorials on the forum, but it seems like none of them explains the BASIC of the language, making it really hard to understand.
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new query[512];
new Float: tmpX, Float: tmpY, Float: tmpZ, Float: tmpA;
GetPlayerPos(playerid, tmpX, tmpY, tmpZ);
GetPlayerFacingAngle(playerid, tmpA);
pData[playerid][p_SavePosInterior] = GetPlayerInterior(playerid);
pData[playerid][p_SavePosVW] = GetPlayerVirtualWorld(playerid);
mysql_format(mysql, query, sizeof query, "UPDATE `players` SET `AdminLevel`=%d `SavePos`=%d `SavePosX`=%f `SavePosY`=%f `SavePosZ`=%f `SavePosA`=%f `SavePosInterior`=%d `SavePosVW`=%d `Kills`=%d `Deaths`=%d \
`Score`=%d `Money`=%d WHERE ID=%d", pData[playerid][p_AdminLevel], pData[playerid][p_SavePos], tmpX, tmpY, tmpZ, tmpA,
pData[playerid][p_SavePosInterior], pData[playerid][p_SavePosVW], pData[playerid][p_Kills], pData[playerid][p_Deaths], GetPlayerScore(playerid), GetPlayerMoney(playerid), pData[playerid][p_ID]);
mysql_tquery(mysql, query, "", "");
return 1;
}
I've read so many tutorials on the forum, but it seems like none of them explains the BASIC of the language, making it really hard to understand.