03.04.2015, 20:47
]
this is my turf system
save system
load system
I dont save
turfs[idx][TurfColor], example TEAM_GROVE
turfs[idx][TurfOwner], COLOR_GREEN
and load system don't work help me please man...
PHP код:
enum tinfo
{
turfID,
turfName[ 40 ],
cityName[ 40 ],
Float:zMinX,
Float:zMinY,
Float:zMaxX,
Float:zMaxY,
TurfColor[ 40 ],
TurfOwner[ 40 ],
TurfAttacker,
TurfKills,
TurfAttackKills,
TurfWarStarted,
MIT
}
new turfs[MAX_TURFS][tinfo] = {
{ 0, "Grove Street", "LS", 2440.60, -1629.70, 2540.90, -1723.70, COLOR_GREEN, TEAM_GROVE, -1, 0, 0, 0, 0},
{ 1, "Ganton", "LS", 2440.60, -1629.70, 2226.30, -1723.70, COLOR_GREEN, TEAM_GROVE, -1, 0, 0, 0, 0},
{ 2, "Idlewood", "LS", 1812.60, -1852.80, 1971.60, -1742.30, CIVILIAN_COLOR, TEAM_CIVILIAN, -1, 0, 0, 0, 0},
{ 3, "Idlewood", "LS", 1951.60, -1742.30, 2124.60, -1602.30, CIVILIAN_COLOR, TEAM_CIVILIAN, -1, 0, 0, 0, 0},
{ 4, "Idlewood", "LS", 1812.60, -1602.30, 2124.60, -1449.60, CIVILIAN_COLOR, TEAM_CIVILIAN, -1, 0, 0, 0, 0},
{ 5, "Idlewood", "LS", 2124.60, -1742.30, 2222.50, -1494.00, CIVILIAN_COLOR, TEAM_CIVILIAN, -1, 0, 0, 0, 0},
{ 6, "Idlewood", "LS", 1971.60, -1852.80, 2222.50, -1742.30, CIVILIAN_COLOR, TEAM_CIVILIAN, -1, 0, 0, 0, 0},
{ 7, "Idlewood", "LS", 1812.60, -1742.30, 1951.60, -1602.30, CIVILIAN_COLOR, TEAM_CIVILIAN, -1, 0, 0, 0, 0},
{ 8, "Willow Field", "LS", 1970.60, -2179.20, 2089.00, -1852.80, AZTECA_COLOR, TEAM_AZTECAS, -1, 0, 0, 0, 0},
{ 9, "Willow Field", "LS", 2089.00, -1989.90, 2324.00, -1852.80, AZTECA_COLOR, TEAM_AZTECAS, -1, 0, 0, 0, 0},
{ 10, "Willow Field", "LS", 2089.00, -2235.80, 2201.80, -1989.90, AZTECA_COLOR, TEAM_AZTECAS, -1, 0, 0, 0, 0},
{ 11, "Jefferson", "LS", 2056.80, -1372.00, 2281.40, -1210.70, BALLA_COLOR, TEAM_BALLAS, -1, 0, 0, 0, 0},
{ 12, "Jefferson", "LS", 2056.80, -1210.70, 2185.30, -1126.30, BALLA_COLOR, TEAM_BALLAS, -1, 0, 0, 0, 0},
{ 13, "Jefferson", "LS", 2056.80, -1449.60, 2266.20, -1372.00, BALLA_COLOR, TEAM_BALLAS, -1, 0, 0, 0, 0},
{ 14, "East Los Santos", "LS", 2421.00, -1628.50, 2632.80, -1454.30, CIVILIAN_COLOR, TEAM_CIVILIAN, -1, 0, 0, 0, 0}
};
new TurfInfo[MAX_TURFS][MAX_TEAMS][tinfo];
PHP код:
forward SaveTurfs();
public SaveTurfs()
{
new idx;
new File: file2;
while (idx < sizeof(turfs))
gTeam[idx] = turfs[idx][TurfOwner];
{
new coordsstring[512];
format(coordsstring, sizeof(coordsstring), "%d|%s|%s|%d|%d|%d|%d|%f|%d|%d|%d|%d|%d|%d___________________\n",
turfs[idx][turfID],
turfs[idx][turfName],
turfs[idx][cityName],
turfs[idx][zMinX],
turfs[idx][zMinY],
turfs[idx][zMaxX],
turfs[idx][zMaxY],
turfs[idx][TurfColor],
turfs[idx][TurfOwner],
turfs[idx][TurfAttacker],
turfs[idx][TurfKills],
turfs[idx][TurfAttackKills],
turfs[idx][TurfWarStarted],
turfs[idx][MIT]);
if(idx == 0)
{
file2 = fopen("Factions/Turfs.ini", io_write);
}
else
{
file2 = fopen("Factions/Turfs.ini", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}
PHP код:
forward LoadTurfs();
public LoadTurfs()
{
new arrCoords[14][256];
new strFromFile2[256];
new File: file = fopen("Factions/Turfs.ini", io_read);
if (file)
{
new playerid;
while (playerid < sizeof(turfs))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, '|');
turfs[playerid][turfID] = strval(arrCoords[0]);
strmid(turfs[playerid][turfName], arrCoords[1], 0, strlen(arrCoords[0]), 255);
strmid(turfs[playerid][cityName], arrCoords[2], 0, strlen(arrCoords[0]), 255);
turfs[playerid][zMinX] = strval(arrCoords[3]);
turfs[playerid][zMinY] = strval(arrCoords[4]);
turfs[playerid][zMaxX] = strval(arrCoords[5]);
turfs[playerid][zMaxY] = strval(arrCoords[6]);
strmid(turfs[playerid][TurfColor], arrCoords[7], 0, strlen(arrCoords[0]), 255);
strmid(turfs[playerid][TurfOwner], arrCoords[8], 0, strlen(arrCoords[0]), 255);
turfs[playerid][TurfAttacker] = strval(arrCoords[9]);
turfs[playerid][TurfKills] = strval(arrCoords[10]);
turfs[playerid][TurfAttackKills] = strval(arrCoords[11]);
turfs[playerid][TurfWarStarted] = strval(arrCoords[12]);
turfs[playerid][MIT] = strval(arrCoords[13]);
playerid++;
}
fclose(file);
}
return 1;
}
I dont save
turfs[idx][TurfColor], example TEAM_GROVE
turfs[idx][TurfOwner], COLOR_GREEN
and load system don't work help me please man...
![Confused](images/smilies/confused.png)