03.10.2013, 17:47
Quote:
Bom, fiz um script que salve a posiзгo X Y Z do player no servidor e envie para o banco de dados.
Ao deslogar: pawn Код:
|
pawn Код:
format(query, sizeof(query), "UPDATE `playerinfo` SET PosX = '%f', PosY = '%f', PosZ = '%f' ,PosA = '%f' WHERE `Name` = '%s'", x, y, z, z, GetName(playerid));
Vocк colocou que PosA = z
...
Ok... De qualquer forma, fiz um para vocк , jб testei e deu CERTINHO... Mas em DINI:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new File:file, pasta[40],Float:Pos[4], String[50], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(pasta, 40, Pasta, pName);
format(String, sizeof(String), "•••• %s ••••", pName);
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
GetPlayerFacingAngle(playerid, Pos[3]);
file = fopen(pasta);
fwrite(file, String);
dini_FloatSet(pasta, "PosX", Pos[0]);
dini_FloatSet(pasta, "PosY", Pos[1]);
dini_FloatSet(pasta, "PosZ", Pos[2]);
dini_FloatSet(pasta, "PosA", Pos[3]);
fwrite(file, String);
return 1;
}
public OnPlayerSpawn(playerid)
{
new pasta[40], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(pasta, 40, Pasta, pName);
if(!dini_Exists(pasta)) return dini_Create(pasta);
SetPlayerPos(playerid, dini_Float(pasta, "PosX"), dini_Float(pasta, "PosY"), dini_Float(pasta, "PosZ"));
SetPlayerFacingAngle(playerid, dini_Float(pasta, "PosA"));
return 1;
}