26.03.2016, 21:07
Tente
PHP код:
CMD:sav(playerid,params[])
{
new str[100],Float:X,Float:Y,Float:Z,Float:Rotation;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,Rotation);
new File:file;
while(p < 100)
{
format(str,100,"X_%f,Y_%f,Z_%f,R_%f\r\n",X,Y,Z,Rotation);
if(p == 0)
{
file = fopen("positions.txt",io_write);
}
else
{
file = fopen("positions.txt",io_append);
}
fwrite(pos,string);
fclose(pos);
p++;
}
return 1;
}
new Float:rX[10],Float:rY[10],Float:rZ[10],Float:rR[10];
CMD:load(playerid,params[])
{
new pos[4];
new string[512];
new File: file = fopen("positions.txt",io_read);
if(file)
{
new p = 0;
while(p < 100)
{
fread(file,string);
split(string,pos,'|');
rX = floatstr(pos[0]);
rY = floatstr(pos[1]);
rZ = floatstr(pos[2]);
rR = floatstr(pos[3]);
p++;
}
}
return 1;
}
stock split(const strsrc[],strdest[][],delimiter)
{
new i,li;
new aNum;
new len;
while(i <= strlen(strsrc))
{
if(strsrc[i] == delimiter || i == strlen(strsrc))
{
len = strmid(strdest[aNum],strsrc,li,i,128);
strdest[aNum][len] = 0;
li = i+1;
aNum++;
}
i++;
}
return 1;
}