enum dInfo
{
Float:dExteriorX,
Float:dExteriorY,
Float:dExteriorZ,
dExteriorInt,
Float:dInteriorX,
Float:dInteriorY,
Float:dInteriorZ,
dInteriorInt,
dName[128],
dPp
}
new DoorInfo[MAX_DOORS][dInfo];
new Iterator:Doors<MAX_DOORS>, dCount;
public OnGameModeInit()
{
for(new d=0;d< MAX_DOORS;d++)
{
LoadDoor(d);
}
return 1;
}
stock LoadDoor(id)
{
new string[128], string2[128], name[128];
format(string, sizeof(string), "Door_%d", id);
if(djIsSet(DOORS_FILE, string))
{
format(string2, sizeof(string2),"Door_%d/ExteriorX", id); DoorInfo[id][dExteriorX] = djFloat(DOORS_FILE, string);
format(string2, sizeof(string2),"Door_%d/ExteriorY", id); DoorInfo[id][dExteriorY] = djFloat(DOORS_FILE, string);
format(string2, sizeof(string2),"Door_%d/ExteriorZ", id); DoorInfo[id][dExteriorZ] = djFloat(DOORS_FILE, string);
format(string2, sizeof(string2),"Door_%d/ExteriorInt", id); DoorInfo[id][dExteriorInt] = djInt(DOORS_FILE, string);
format(string2, sizeof(string2),"Door_%d/InteriorX", id); DoorInfo[id][dInteriorX] = djFloat(DOORS_FILE, string);
format(string2, sizeof(string2),"Door_%d/InteriorY", id); DoorInfo[id][dInteriorY] = djFloat(DOORS_FILE, string);
format(string2, sizeof(string2),"Door_%d/InteriorZ", id); DoorInfo[id][dInteriorZ] = djFloat(DOORS_FILE, string);
format(string2, sizeof(string2),"Door_%d/InteriorInt", id); DoorInfo[id][dInteriorInt] = djInt(DOORS_FILE, string);
format(string2, sizeof(string2),"Door_%d/Name", id); format(name, sizeof(name), "%s", dj(DOORS_FILE, string2)); DoorInfo[id][dName] = name;
Iter_Add(Doors, id);
DoorInfo[id][dPp] = CreateDynamicPickup(1239, 2, DoorInfo[id][dExteriorX], DoorInfo[id][dExteriorY], DoorInfo[id][dExteriorZ], -1, DoorInfo[id][dExteriorInt], -1, 50.0);
return 1;
}
return 1;
}
stock AddDoor(Float:x, Float:y, Float:z, interior, name[])
{
new string2[128];
dCount ++;
Itter_Add(Doors, dCount);
format(string2, sizeof(string2), "Door_%d/ExteriorX", dCount); djSetFloat(DOORS_FILE, string2, x);
format(string2, sizeof(string2), "Door_%d/ExteriorY", dCount); djSetFloat(DOORS_FILE, string2, y);
format(string2, sizeof(string2), "Door_%d/ExteriorZ", dCount); djSetFloat(DOORS_FILE, string2, z);
format(string2, sizeof(string2), "Door_%d/ExteriorInt", dCount); djSetInt(DOORS_FILE, string2, interior);
format(string2, sizeof(string2), "Door_%d/InteriorX", dCount); djSetFloat(DOORS_FILE, string2, 0);
format(string2, sizeof(string2), "Door_%d/InteriorY", dCount); djSetFloat(DOORS_FILE, string2, 0);
format(string2, sizeof(string2), "Door_%d/InteriorZ", dCount); djSetFloat(DOORS_FILE, string2, 0);
format(string2, sizeof(string2), "Door_%d/InteriorInt", dCount); djSetInt(DOORS_FILE, string2, 0);
format(string2, sizeof(string2), "Door_%d/Name", dCount); djSet(DOORS_FILE, string2, name);
LoadDoor(dCount);
return 1;
}
// Use this under OnGameModeInit() - for loading
stock LoadDoor(id)
{
new string[128], string2[128], name[128];
format(string, sizeof(string), "Door_%d", id);
if(djIsSet(DOORS_FILE, string))
{
format(string2, sizeof(string2),"Door_%d/ExteriorX", id); DoorInfo[id][dExteriorX] = djFloat(DOORS_FILE, string);
format(string2, sizeof(string2),"Door_%d/ExteriorY", id); DoorInfo[id][dExteriorY] = djFloat(DOORS_FILE, string);
format(string2, sizeof(string2),"Door_%d/ExteriorZ", id); DoorInfo[id][dExteriorZ] = djFloat(DOORS_FILE, string);
format(string2, sizeof(string2),"Door_%d/ExteriorInt", id); DoorInfo[id][dExteriorInt] = djInt(DOORS_FILE, string);
format(string2, sizeof(string2),"Door_%d/InteriorX", id); DoorInfo[id][dInteriorX] = djFloat(DOORS_FILE, string);
format(string2, sizeof(string2),"Door_%d/InteriorY", id); DoorInfo[id][dInteriorY] = djFloat(DOORS_FILE, string);
format(string2, sizeof(string2),"Door_%d/InteriorZ", id); DoorInfo[id][dInteriorZ] = djFloat(DOORS_FILE, string);
format(string2, sizeof(string2),"Door_%d/InteriorInt", id); DoorInfo[id][dInteriorInt] = djInt(DOORS_FILE, string);
format(string2, sizeof(string2),"Door_%d/Name", id); format(name, sizeof(name), "%s", dj(DOORS_FILE, string2)); DoorInfo[id][dName] = name;
Itter_Add(Doors, Iter_Count(Doors) + 1);
DoorInfo[id][dPp] = CreateDynamicPickup(1239, 2, DoorInfo[id][dExteriorX], DoorInfo[id][dExteriorY], DoorInfo[id][dExteriorZ], -1, DoorInfo[id][dExteriorInt], -1, 50.0);
return 1;
}
return 1;
}
stock AddDoor(Float:x, Float:y, Float:z, interior, name[])
{
new string2[128];
Itter_Add(Doors, Iter_Count(Doors) + 1);
dCount = Iter_Count(Doors) ;
format(string2, sizeof(string2), "Door_%d/ExteriorX", dCount); djSetFloat(DOORS_FILE, string2, x);
format(string2, sizeof(string2), "Door_%d/ExteriorY", dCount); djSetFloat(DOORS_FILE, string2, y);
format(string2, sizeof(string2), "Door_%d/ExteriorZ", dCount); djSetFloat(DOORS_FILE, string2, z);
format(string2, sizeof(string2), "Door_%d/ExteriorInt", dCount); djSetInt(DOORS_FILE, string2, interior);
format(string2, sizeof(string2), "Door_%d/InteriorX", dCount); djSetFloat(DOORS_FILE, string2, 0);
format(string2, sizeof(string2), "Door_%d/InteriorY", dCount); djSetFloat(DOORS_FILE, string2, 0);
format(string2, sizeof(string2), "Door_%d/InteriorZ", dCount); djSetFloat(DOORS_FILE, string2, 0);
format(string2, sizeof(string2), "Door_%d/InteriorInt", dCount); djSetInt(DOORS_FILE, string2, 0);
format(string2, sizeof(string2), "Door_%d/Name", dCount); djSet(DOORS_FILE, string2, name);
DoorInfo[dCount][dExteriorX] = x;
DoorInfo[dCount][dExteriorY] = y;
DoorInfo[dCount][dExteriorZ] = z;
DoorInfo[dCount][dExteriorInt] = interior;
DoorInfo[dCount][dInteriorX] = // interior
DoorInfo[dCount][dInteriorY] = // interior
DoorInfo[dCount][dInteriorZ] = // interior
format(DoorInfo[dCount][dName], sizeof(DoorInfo[dCount][dName]), "%s", name);
DoorInfo[dCount][dPp] = CreateDynamicPickup(1239, 2, DoorInfo[dCount][dExteriorX], DoorInfo[dCount][dExteriorY], DoorInfo[dCount][dExteriorZ], -1, DoorInfo[dCount][dExteriorInt], -1, 50.0);
return 1;
}
Yay, thanks. AddDoor works fine now, but LoadDoor(id); function doesn't. By the way my RP from scratch is also called O:RP
![]() |
stock LoadDoor(id)
{
new string[128], string2[128], name[128];
format(string, sizeof(string), "Door_%d", id);
if(djIsSet(DOORS_FILE, string))
{
format(string2, sizeof(string2),"Door_%d/ExteriorX", id);
printf("ExteriorX: %f", djFloat(DOORS_FILE, string));
format(string2, sizeof(string2),"Door_%d/ExteriorY", id);
printf("ExteriorY: %f", djFloat(DOORS_FILE, string));
format(string2, sizeof(string2),"Door_%d/ExteriorZ", id);
printf("ExteriorZ: %f", djFloat(DOORS_FILE, string));
return 1;
}
return 1;
}