// For Showrooms
new Iterator:SRs<MAX_SHOWROOM>;
// -GetEmptyShowroomID
GetEmptyShowroomID()
{
return Iter_Free(SRs);
}
// For Showroom
// - CreateShowroom
public CreateShowroom(Name[], Float:X, Float:Y, Float:Z)
{
new CreatedID = GetEmptyShowroomID();
Iter_Add(SRs, CreatedID);
LastShowroomID = Iter_Last(SRs)+1;
format(Showrooms[CreatedID][SRName], 100, Name);
Showrooms[CreatedID][SRX] = X;
Showrooms[CreatedID][SRY] = Y;
Showrooms[CreatedID][SRZ] = Z;
Showrooms[CreatedID][SRExist] = 1;
Showrooms[CreatedID][SRPick] = CreatePickup(1239, 1, X, Y, Z, 0);
new String[128];
format(String, 128, "{ADFF2F}SHOWROOM\n{ADFF2F}%s\n{FFFFFF}Showroom ID {ADFF2F}%d", Showrooms[CreatedID][SRName], CreatedID);
Showrooms[CreatedID][SR3D] = Create3DTextLabel(String, -1, X, Y, Z, 25.0, 0);
new FileName[50];
format(FileName, 50, "%s/Showroom_%d.ini", EVOVEHICLE_SHOWROOM_DIR, CreatedID);
new INI:SRFile = INI_OpenFile(FileName);
INI_SetTag(SRFile, "evo");
INI_TypeString(SRFile, "NAME", Name);
INI_TypeFloat(SRFile, "X", X);
INI_TypeFloat(SRFile, "Y", Y);
INI_TypeFloat(SRFile, "Z", Z);
INI_CloseFile(SRFile);
return CreatedID;
}
#define GetEmptyShowroomID() Iter_Free(SRs)
#define GetEmptyShowroomID() Iter_Free(SRs)
public CreateShowroom(Name[], Float:X, Float:Y, Float:Z)
{
new
CreatedID = GetEmptyShowroomID();
printf("Showroom: Fetched showroom %d", CreatedID);
Iter_Add(SRs, CreatedID);
//I'm not quite sure what is LastShowroomID supposed to point at. Last
//ID inserted is just one line higher, and it's CreatedID.
//Iter_Last + 1 should be substituted with Iter_Free
LastShowroomID = GetEmptyShowroomID();
if(LastShowroomID == -1) {
printf("Showroom: There is no more free slots!");
return 0;
}
format(Showrooms[CreatedID][SRName], 100, Name);
Showrooms[CreatedID][SRX] = X;
Showrooms[CreatedID][SRY] = Y;
Showrooms[CreatedID][SRZ] = Z;
Showrooms[CreatedID][SRExist] = 1;
Showrooms[CreatedID][SRPick] = CreatePickup(1239, 1, X, Y, Z, 0);
new String[128];
format(String, 128, "{ADFF2F}SHOWROOM\n{ADFF2F}%s\n{FFFFFF}Showroom ID {ADFF2F}%d", Showrooms[CreatedID][SRName], CreatedID);
Showrooms[CreatedID][SR3D] = Create3DTextLabel(String, -1, X, Y, Z, 25.0, 0);
new FileName[50];
format(FileName, 50, "%s/Showroom_%d.ini", EVOVEHICLE_SHOWROOM_DIR, CreatedID);
new INI:SRFile = INI_OpenFile(FileName);
INI_SetTag(SRFile, "evo");
INI_TypeString(SRFile, "NAME", Name);
INI_TypeFloat(SRFile, "X", X);
INI_TypeFloat(SRFile, "Y", Y);
INI_TypeFloat(SRFile, "Z", Z);
INI_CloseFile(SRFile);
return CreatedID;
}
Showroom: Fetched showroom 0 |