PDA

View Full Version : Help me please for reload gang zone/turf


Cr3dO
07/07/2015, 02:51 PM
I use gangzone system


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},
{ 15, "East Los Santos", "LS", 2222.50, -1628.50, 2421.00, -1494.00, CIVILIAN_COLOR, TEAM_CIVILIAN, -1, 0, 0, 0, 0},
{ 16, "East Los Santos", "LS", 2266.20, -1494.00, 2381.60, -1372.00, BALLA_COLOR, TEAM_BALLAS, -1, 0, 0, 0, 0},
{ 17, "East Los Santos", "LS", 2281.60, -1372.00, 2381.60, -1135.00, BALLA_COLOR, TEAM_BALLAS, -1, 0, 0, 0, 0},
{ 18, "East Los Santos", "LS", 2381.60, -1454.30, 2462.10, -1135.00, VAGOS_COLOR, TEAM_VAGOS, -1, 0, 0, 0, 0},
{ 19, "East Los Santos", "LS", 2462.10, -1454.30, 2581.70, -1135.00, VAGOS_COLOR, TEAM_VAGOS, -1, 0, 0, 0, 0},
{ 20, "El Corona", "LS", 1812.60, -2179.20, 1970.60, -1852.80, AZTECA_COLOR, TEAM_AZTECAS, -1, 0, 0, 0, 0},
{ 21, "El Corona", "LS", 1692.60, -2179.20, 1812.60, -1842.20, AZTECA_COLOR, TEAM_AZTECAS, -1, 0, 0, 0, 0},
{ 22, "Glen Park", "LS", 1812.60, -1350.70, 2056.80, -1100.80, BALLA_COLOR, TEAM_BALLAS, -1, 0, 0, 0, 0},
{ 23, "Los Flores", "LS", 2581.70, -1393.40, 2747.70, -1135.00, VAGOS_COLOR, TEAM_VAGOS, -1, 0, 0, 0, 0},
{ 24, "Las Colinas", "LS", 1994.30, -1100.80, 2056.80, -920.80, BALLA_COLOR, TEAM_BALLAS, -1, 0, 0, 0, 0},
{ 25, "Las Colinas", "LS", 2056.80, -1126.30, 2126.80, -920.80, BALLA_COLOR, TEAM_BALLAS, -1, 0, 0, 0, 0},
{ 26, "Las Colinas", "LS", 2185.30, -1154.50, 2281.40, -934.40, VAGOS_COLOR, TEAM_VAGOS, -1, 0, 0, 0, 0},
{ 27, "Las Colinas", "LS", 2126.80, -1126.30, 2185.30, -934.40, VAGOS_COLOR, TEAM_VAGOS, -1, 0, 0, 0, 0},
{ 28, "Las Colinas", "LS", 2632.70, -1135.00, 2747.70, -945.00, VAGOS_COLOR, TEAM_VAGOS, -1, 0, 0, 0, 0},
{ 29, "Las Colinas", "LS", 2281.40, -1135.00, 2632.70, -945.00, VAGOS_COLOR, TEAM_VAGOS, -1, 0, 0, 0, 0},
{ 30, "Temple", "LS", 1153.92, -1158.21, 1344.07, -1025.30, TRIAD_COLOR, TEAM_TRIADS, -1, 0, 0, 0, 0},
{ 31, "Temple", "LS", 954.83, -1158.21, 1153.92, -1025.30, TRIAD_COLOR, TEAM_TRIADS, -1, 0, 0, 0, 0},
{ 32, "Vinewood", "LS", 789.10, -1158.21, 954.83, -936.29, TRIAD_COLOR, TEAM_TRIADS, -1, 0, 0, 0, 0},
{ 33, "Temple", "LS", 954.75, -1025.30, 1152.46, -936.29, TRIAD_COLOR, TEAM_TRIADS, -1, 0, 0, 0, 0},
{ 34, "Temple", "LS", 1049.42, -1289.62, 1221.19, -1158.21, TRIAD_COLOR, TEAM_TRIADS, -1, 0, 0, 0, 0},
{ 35, "Temple", "LS", 1221.19, -1289.62, 1341.26, -1158.21, TRIAD_COLOR, TEAM_TRIADS, -1, 0, 0, 0, 0},
{ 36, "Vinewood", "LS", 1153.92, -1025.30, 1341.26, -862.01, TRIAD_COLOR, TEAM_TRIADS, -1, 0, 0, 0, 0},
{ 37, "Verona Beach", "LS", 1145.10, -1718.26, 1292.30, -1565.49, DANANGBOYS_COLOR, TEAM_DANANGBOYS, -1, 0, 0, 0, 0},
{ 38, "Verona Beach", "LS", 1041.96, -1718.26, 1145.10, -1565.49, DANANGBOYS_COLOR, TEAM_DANANGBOYS, -1, 0, 0, 0, 0},
{ 39, "Conference Center", "LS", 1041.96, -1860.83, 1177.37, -1718.26, DANANGBOYS_COLOR, TEAM_DANANGBOYS, -1, 0, 0, 0, 0},
{ 40, "Conference Center", "LS", 1177.37, -1860.83, 1292.30, -1718.26, DANANGBOYS_COLOR, TEAM_DANANGBOYS, -1, 0, 0, 0, 0},
{ 41, "Verona Beach", "LS", 910.96, -1860.83, 1041.96, -1718.26, DANANGBOYS_COLOR, TEAM_DANANGBOYS, -1, 0, 0, 0, 0},
{ 42, "Verona Beach", "LS", 910.96, -1718.26, 1041.96, -1410.60, DANANGBOYS_COLOR, TEAM_DANANGBOYS, -1, 0, 0, 0, 0},
{ 43, "Market", "LS", 1041.96, -1565.49, 1347.25, -1410.60, DANANGBOYS_COLOR, TEAM_DANANGBOYS, -1, 0, 0, 0, 0},
{ 44, "Santa Maria Beach", "LS", 349.85, -2088.68, 622.75,-1684.52, CRIPZ_COLOR, TEAM_CRIPZ, -1, 0, 0, 0, 0},
{ 45, "Santa Maria Beach", "LS", 622.75, -2088.68, 804.95, -1684.52, CRIPZ_COLOR, TEAM_CRIPZ, -1, 0, 0, 0, 0},
{ 46, "Verona Beach", "LS", 804.95, -2088.68, 912.48, -1684.52, CRIPZ_COLOR, TEAM_CRIPZ, -1, 0, 0, 0, 0},
{ 46, "Rodeo", "LS", 359.47, -1684.52, 522.61, -1410.60, CRIPZ_COLOR, TEAM_CRIPZ, -1, 0, 0, 0, 0},
{ 47, "Rodeo", "LS", 522.61, -1684.52, 629.04, -1410.60, CRIPZ_COLOR, TEAM_CRIPZ, -1, 0, 0, 0, 0},
{ 48, "Marina", "LS", 629.04, -1684.52, 792.07, -1410.60, CRIPZ_COLOR, TEAM_CRIPZ, -1, 0, 0, 0, 0},
{ 49, "Verona Beach", "LS", 792.07, -1684.52, 910.96, -1410.60, CRIPZ_COLOR, TEAM_CRIPZ, -1, 0, 0, 0, 0},
{ 50, "Verona Beach", "LS", 912.48, -2088.68, 1057.43, -1860.83, CRIPZ_COLOR, TEAM_CRIPZ, -1, 0, 0, 0, 0}
};
new TurfInfo[MAX_TURFS][MAX_TEAMS][tinfo];
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;
}

forward SaveTurfs();
public SaveTurfs()
{
new idx;
new idxz;
new File: file2;
while (idx < sizeof(turfs))
{
new coordsstring[512];
format(coordsstring, sizeof(coordsstring), "%d|%s|%s|%d|%d|%d|%d|%x|%s|%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], // don't save COLOR_GREEN, use Hex %x
turfs[idx][TurfOwner], // dont save TEAM_GROVE, use %s
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;
}

Dont work please edit Load and Save functions

Cr3dO
07/07/2015, 07:25 PM
Help me please