PDA

View Full Version : Load Lockers


AchievementMaster360
19/01/2014, 06:50 PM
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:

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;
}

SaveDynamicLocker Code:

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);
}

AchievementMaster360
20/01/2014, 11:57 PM
I don't know what else it could be, I re-check today.

Smally
21/01/2014, 10:07 AM
Can you show your CreateDynamicLocker function please?

AchievementMaster360
21/01/2014, 08:03 PM
CreateDynamicLocker(lockerid)
{
new string[128];
format(string, sizeof(string), "%s\n{33FFFF}/locker {FFFF00}to use\n{FFFF00}ID: %d",LockerInfo[lockerid][dlDescription],lockerid);

switch(LockerInfo[lockerid][dlColor])
{
case -1:{ /* Disable 3d Textdraw */ }
case 1:{ LockerInfo[lockerid][dlTextID] = CreateDynamic3DTextLabel(string, COLOR_TWWHITE, LockerInfo[lockerid][dlExteriorX], LockerInfo[lockerid][dlExteriorY], LockerInfo[lockerid][dlExteriorZ]+1,10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, LockerInfo[lockerid][dlExteriorVW], LockerInfo[lockerid][dlExteriorInt], -1);}
case 2:{ LockerInfo[lockerid][dlTextID] = CreateDynamic3DTextLabel(string, COLOR_TWPINK, LockerInfo[lockerid][dlExteriorX], LockerInfo[lockerid][dlExteriorY], LockerInfo[lockerid][dlExteriorZ]+1,10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, LockerInfo[lockerid][dlExteriorVW], LockerInfo[lockerid][dlExteriorInt], -1);}
case 3:{ LockerInfo[lockerid][dlTextID] = CreateDynamic3DTextLabel(string, COLOR_TWRED, LockerInfo[lockerid][dlExteriorX], LockerInfo[lockerid][dlExteriorY], LockerInfo[lockerid][dlExteriorZ]+1,10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, LockerInfo[lockerid][dlExteriorVW], LockerInfo[lockerid][dlExteriorInt], -1);}
case 4:{ LockerInfo[lockerid][dlTextID] = CreateDynamic3DTextLabel(string, COLOR_TWBROWN, LockerInfo[lockerid][dlExteriorX], LockerInfo[lockerid][dlExteriorY], LockerInfo[lockerid][dlExteriorZ]+1,10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, LockerInfo[lockerid][dlExteriorVW], LockerInfo[lockerid][dlExteriorInt], -1);}
case 5:{ LockerInfo[lockerid][dlTextID] = CreateDynamic3DTextLabel(string, COLOR_TWGRAY, LockerInfo[lockerid][dlExteriorX], LockerInfo[lockerid][dlExteriorY], LockerInfo[lockerid][dlExteriorZ]+1,10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, LockerInfo[lockerid][dlExteriorVW], LockerInfo[lockerid][dlExteriorInt], -1);}
case 6:{ LockerInfo[lockerid][dlTextID] = CreateDynamic3DTextLabel(string, COLOR_TWOLIVE, LockerInfo[lockerid][dlExteriorX], LockerInfo[lockerid][dlExteriorY], LockerInfo[lockerid][dlExteriorZ]+1,10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, LockerInfo[lockerid][dlExteriorVW], LockerInfo[lockerid][dlExteriorInt], -1);}
case 7:{ LockerInfo[lockerid][dlTextID] = CreateDynamic3DTextLabel(string, COLOR_TWPURPLE, LockerInfo[lockerid][dlExteriorX], LockerInfo[lockerid][dlExteriorY], LockerInfo[lockerid][dlExteriorZ]+1,10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, LockerInfo[lockerid][dlExteriorVW], LockerInfo[lockerid][dlExteriorInt], -1);}
case 8:{ LockerInfo[lockerid][dlTextID] = CreateDynamic3DTextLabel(string, COLOR_TWORANGE, LockerInfo[lockerid][dlExteriorX], LockerInfo[lockerid][dlExteriorY], LockerInfo[lockerid][dlExteriorZ]+1,10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, LockerInfo[lockerid][dlExteriorVW], LockerInfo[lockerid][dlExteriorInt], -1);}
case 9:{ LockerInfo[lockerid][dlTextID] = CreateDynamic3DTextLabel(string, COLOR_TWAZURE, LockerInfo[lockerid][dlExteriorX], LockerInfo[lockerid][dlExteriorY], LockerInfo[lockerid][dlExteriorZ]+1,10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, LockerInfo[lockerid][dlExteriorVW], LockerInfo[lockerid][dlExteriorInt], -1);}
case 10:{ LockerInfo[lockerid][dlTextID] = CreateDynamic3DTextLabel(string, COLOR_TWGREEN, LockerInfo[lockerid][dlExteriorX], LockerInfo[lockerid][dlExteriorY], LockerInfo[lockerid][dlExteriorZ]+1,10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, LockerInfo[lockerid][dlExteriorVW], LockerInfo[lockerid][dlExteriorInt], -1);}
case 11:{ LockerInfo[lockerid][dlTextID] = CreateDynamic3DTextLabel(string, COLOR_TWBLUE, LockerInfo[lockerid][dlExteriorX], LockerInfo[lockerid][dlExteriorY], LockerInfo[lockerid][dlExteriorZ]+1,10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, LockerInfo[lockerid][dlExteriorVW], LockerInfo[lockerid][dlExteriorInt], -1);}
case 12:{ LockerInfo[lockerid][dlTextID] = CreateDynamic3DTextLabel(string, COLOR_TWBLACK, LockerInfo[lockerid][dlExteriorX], LockerInfo[lockerid][dlExteriorY], LockerInfo[lockerid][dlExteriorZ]+1,10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, LockerInfo[lockerid][dlExteriorVW], LockerInfo[lockerid][dlExteriorInt], -1);}
case 13:{ LockerInfo[lockerid][dlTextID] = CreateDynamic3DTextLabel(string, COLOR_MW, LockerInfo[lockerid][dlExteriorX], LockerInfo[lockerid][dlExteriorY], LockerInfo[lockerid][dlExteriorZ]+1,10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, LockerInfo[lockerid][dlExteriorVW], LockerInfo[lockerid][dlExteriorInt], -1);}
default:{ LockerInfo[lockerid][dlTextID] = CreateDynamic3DTextLabel(string, COLOR_YELLOW, LockerInfo[lockerid][dlExteriorX], LockerInfo[lockerid][dlExteriorY], LockerInfo[lockerid][dlExteriorZ]+1,10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, LockerInfo[lockerid][dlExteriorVW], LockerInfo[lockerid][dlExteriorInt], -1);}
}
}

AchievementMaster360
22/01/2014, 10:04 PM
Any ideas?