stock LoadHouses()
{
new path[128];
for(new i=1; i<MAX_HOUSES; i++)
{
format(path, 128, "Houses/%i.ini", i);
strmid(HouseInfo[i][hOwner], dini_Get(path,"Owner"), 0, strlen(dini_Get(path,"Owner")), 255);
strmid(HouseInfo[i][hDes], dini_Get(path,"Description"), 0, strlen(dini_Get(path,"Description")), 255);
HouseInfo[i][hOwned] = dini_Int(path, "Owned");
HouseInfo[i][hPrice] = dini_Int(path, "Price");
HouseInfo[i][hRent] = dini_Int(path, "Rent");
HouseInfo[i][hInterior] = dini_Int(path, "Interior");
HouseInfo[i][hWorld] = dini_Int(path, "World");
HouseInfo[i][hX] = dini_Float(path, "X");
HouseInfo[i][hY] = dini_Float(path, "Y");
HouseInfo[i][hZ] = dini_Float(path, "Z");
HouseInfo[i][hA] = dini_Float(path, "A");
HousePick[i] = CreatePickup(1273, 1, HouseInfo[i][hX],HouseInfo[i][hY],HouseInfo[i][hZ], -1);
print("Houses loaded");
return 1;
}
return 1;
}
|
Hey guys!
My pickups are not loading, but why not? LoadHouses(); is called under ongamemodeinit. Код:
stock LoadHouses()
{
new path[128];
for(new i=1; i<MAX_HOUSES; i++)
{
format(path, 128, "Houses/%i.ini", i);
strmid(HouseInfo[i][hOwner], dini_Get(path,"Owner"), 0, strlen(dini_Get(path,"Owner")), 255);
strmid(HouseInfo[i][hDes], dini_Get(path,"Description"), 0, strlen(dini_Get(path,"Description")), 255);
HouseInfo[i][hOwned] = dini_Int(path, "Owned");
HouseInfo[i][hPrice] = dini_Int(path, "Price");
HouseInfo[i][hRent] = dini_Int(path, "Rent");
HouseInfo[i][hInterior] = dini_Int(path, "Interior");
HouseInfo[i][hWorld] = dini_Int(path, "World");
HouseInfo[i][hX] = dini_Float(path, "X");
HouseInfo[i][hY] = dini_Float(path, "Y");
HouseInfo[i][hZ] = dini_Float(path, "Z");
HouseInfo[i][hA] = dini_Float(path, "A");
HousePick[i] = CreatePickup(1273, 1, HouseInfo[i][hX],HouseInfo[i][hY],HouseInfo[i][hZ], -1);
print("Houses loaded");
return 1;
}
return 1;
}
|
|
The housing system is something you cannot see? Only pickups are seen?
I dont really get it :P |
COMMAND:createhouse(playerid, params[])
{
if(IsPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "You're not logged in!");
if(PlayerInfo[playerid][pAdmin] <= 5) return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use this command!");
new interior;
new name[256];
new price;
new h;
if(sscanf(params, "iis[104]", h, interior, price, name))
{
SendClientMessage(playerid, COLOR_CRED, "Syntax: /createhouse");
return 1;
}
new path[68];
format(path, 68, "Houses/%i.ini", h);
if(INI_Exists(path) == 1) return SendClientMessage(playerid, COLOR_CRED, "There is already a house with this ID!");
new randvir = 2 + random(1999999);
new Float:x, Float:y, Float:z;
new Float:a;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid, a);
HouseInfo[h][hX] = x;
HouseInfo[h][hY] = y;
HouseInfo[h][hZ] = z;
HouseInfo[h][hA] = a;
HouseInfo[h][hDes] = name;
HouseInfo[h][hPrice] = price;
HouseInfo[h][hWorld] = randvir;
HouseInfo[h][hRent] = 0;
HouseInfo[h][hOwner] = 0;
HouseInfo[h][hOwned] = 0;
SaveHouses(h);
HousePick[h] = CreatePickup(1273, 1, x,y,z, -1);
return 1;
}
|
This is where the xyz is being created:
Код:
COMMAND:createhouse(playerid, params[])
{
if(IsPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "You're not logged in!");
if(PlayerInfo[playerid][pAdmin] <= 5) return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use this command!");
new interior;
new name[256];
new price;
new h;
if(sscanf(params, "iis[104]", h, interior, price, name))
{
SendClientMessage(playerid, COLOR_CRED, "Syntax: /createhouse");
return 1;
}
new path[68];
format(path, 68, "Houses/%i.ini", h);
if(INI_Exists(path) == 1) return SendClientMessage(playerid, COLOR_CRED, "There is already a house with this ID!");
new randvir = 2 + random(1999999);
new Float:x, Float:y, Float:z;
new Float:a;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid, a);
HouseInfo[h][hX] = x;
HouseInfo[h][hY] = y;
HouseInfo[h][hZ] = z;
HouseInfo[h][hA] = a;
HouseInfo[h][hDes] = name;
HouseInfo[h][hPrice] = price;
HouseInfo[h][hWorld] = randvir;
HouseInfo[h][hRent] = 0;
HouseInfo[h][hOwner] = 0;
HouseInfo[h][hOwned] = 0;
SaveHouses(h);
HousePick[h] = CreatePickup(1273, 1, x,y,z, -1);
return 1;
}
SaveHouses(houseid) { new path[128]; format(path, 128, "Houses/%i.ini", houseid); new INI:HouseFile = INI_Open(path); INI_WriteString(HouseFile,"Owner", HouseInfo[houseid][hOwner]); INI_WriteString(HouseFile,"Description", HouseInfo[houseid][hDes]); INI_WriteInt(HouseFile,"Price", HouseInfo[houseid][hPrice]); INI_WriteInt(HouseFile,"Owned", HouseInfo[houseid][hOwned]); INI_WriteInt(HouseFile,"Rent", HouseInfo[houseid][hRent]); INI_WriteInt(HouseFile,"World", HouseInfo[houseid][hWorld]); INI_WriteInt(HouseFile,"Interior", HouseInfo[houseid][hInterior]); INI_WriteFloat(HouseFile,"X", HouseInfo[houseid][hX]); INI_WriteFloat(HouseFile,"Y", HouseInfo[houseid][hY]); INI_WriteFloat(HouseFile,"Z", HouseInfo[houseid][hZ]); INI_WriteFloat(HouseFile,"A", HouseInfo[houseid][hA]); INI_Close(HouseFile); print("Houses saved"); return 1; } So yeah.. XYZ is valued with the position of the player, and at exactly that position should be the pickup. When creating the house with the command, a pickup is spawned but, as the problem explains, it is not being loaded when restarting the server. |
new string[128];
format(string, sizeof(string), "x: %f, y: %f, z: %f", x, y ,z);
print(string);