19.01.2014, 18:50
Well i created a dynamic locker system for my server and it works well. The only thing that doesn't work so well is the color of the label for the locker. I tried everything and I don't know whats not letting it change colors it might be the LoadDynamicLocker. Any help? This only happens after the server restarts when you first change color it works wonder till you restart the server and load the lockers.
LoadDynamicLocker Code:
SaveDynamicLocker Code:
LoadDynamicLocker Code:
pawn Код:
LoadDynamicLocker()
{
new arrCoords[25][64];
new strFromFile2[256];
new File: file = fopen("dynamiclockers.cfg", io_read);
if (file)
{
new idx;
while (idx < sizeof(LockerInfo))
{
fread(file, strFromFile2);
splits(strFromFile2, arrCoords, '|');
strmid(LockerInfo[idx][dlDescription], arrCoords[0], 0, strlen(arrCoords[0]), 128);
LockerInfo[idx][dlExteriorVW] = strval(arrCoords[1]);
LockerInfo[idx][dlExteriorInt] = strval(arrCoords[2]);
LockerInfo[idx][dlExteriorX] = floatstr(arrCoords[3]);
LockerInfo[idx][dlExteriorY] = floatstr(arrCoords[4]);
LockerInfo[idx][dlExteriorZ] = floatstr(arrCoords[5]);
LockerInfo[idx][dlExteriorA] = floatstr(arrCoords[6]);
LockerInfo[idx][dlVIP] = strval(arrCoords[7]);
LockerInfo[idx][dlFamily] = strval(arrCoords[8]);
LockerInfo[idx][dlFaction] = strval(arrCoords[9]);
LockerInfo[idx][dlAdmin] = strval(arrCoords[10]);
LockerInfo[idx][dlColor] = strval(arrCoords[11]);
strmid(LockerInfo[idx][dlPass], arrCoords[12], 0, strlen(arrCoords[12]), 24);
LockerInfo[idx][dlLocked] = strval(arrCoords[13]);
if(!IsNull(LockerInfo[idx][dlDescription]))
{
CreateDynamicLocker(idx);
}
idx++;
}
fclose(file);
}
return 1;
}
pawn Код:
SaveDynamicLocker() {
new
szFileStr[512],
File: fHandle = fopen("dynamiclockers.cfg", io_write);
for(new iIndex; iIndex < MAX_LOCKER; iIndex++) {
format(szFileStr, sizeof(szFileStr), "%s|%d|%d|%f|%f|%f|%f|%d|%d|%d|%d|%s|%d\r\n",
LockerInfo[iIndex][dlDescription],
LockerInfo[iIndex][dlExteriorVW],
LockerInfo[iIndex][dlExteriorInt],
LockerInfo[iIndex][dlExteriorX],
LockerInfo[iIndex][dlExteriorY],
LockerInfo[iIndex][dlExteriorZ],
LockerInfo[iIndex][dlExteriorA],
LockerInfo[iIndex][dlVIP],
LockerInfo[iIndex][dlFamily],
LockerInfo[iIndex][dlFaction],
LockerInfo[iIndex][dlAdmin],
LockerInfo[iIndex][dlColor],
LockerInfo[iIndex][dlPass],
LockerInfo[iIndex][dlLocked]
);
fwrite(fHandle, szFileStr);
}
return fclose(fHandle);
}