22.07.2011, 15:08
Very nice, I usually just use a custom command for saving formatted positions..
.. and then just put them in an array, but this is another method, great job.
pawn Code:
CMD:s(playerid, params[])
{
if(PlayerInfo[playerid][LoggedIn])
{
new Float:X, Float:Y, Float:Z, File:save;
GetPlayerPos(playerid, X, Y, Z);
if(!fexist("lsx/surprisa.txt"))
{
save=fopen("lsx/surprisa.txt",io_write);
fclose(save);
print("File 'suprisa.txt' created succesfully!");
}
new entry[128], entry2[128];
format(entry, 128, "{%.2f, %.2f, %.2f},", X, Y, Z);
format(entry2, 128, "\r\n%s",entry);
save = fopen("lsx/surprisa.txt", io_append);
fwrite(save, entry2);
fclose(save);
SendClientMessage(playerid, White, "Position saved.");
}
else
{
SendClientMessage(playerid, Red, "Log in, fool.");
}
return 1;
}