House Making. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: House Making. (
/showthread.php?tid=215193)
House Making. -
Luis- - 22.01.2011
I have made another command to make a House this time,
pawn Код:
command(createhouse, playerid, params[])
{
new file[128];
new h = MAX_HOUSES;
GetPlayerPos(playerid, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]);
format(file, sizeof(file), "Houses/%d.ini", h);
if(!dini_Exists(file))
{
dini_Create(file);
dini_FloatSet(file, "EnterX", HouseInfo[h][hEnterX]);
dini_FloatSet(file, "EnterY", HouseInfo[h][hEnterY]);
dini_FloatSet(file, "EnterZ", HouseInfo[h][hEnterZ]);
print("Test");
}
if(!fexist(file))
{
SendClientMessage(playerid, COLOR_YELLOW, "[HOUSE-INFO:] This House already Exists.");
}
return 1;
}
It does not work at all?
Re: House Making. -
Elmerz_com - 23.01.2011
I try it works!
Re: House Making. -
Not available - 23.01.2011
I'm not sure about your structure, but this checks if the command does not exists.
pawn Код:
if(!fexist(file))
{
SendClientMessage(playerid, COLOR_YELLOW, "[HOUSE-INFO:] This House already Exists.");
}
Note: Do you really need 128 cells for that file string?
Also what does this do?
pawn Код:
GetPlayerPos(playerid, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]);
You should probably loop thru all houses instead.
Re: House Making. -
Luis- - 23.01.2011
I got it working, But I have this code.
Would this be correct as it is not loading?
pawn Код:
forward LoadHouse();
public LoadHouse()
{
new file[128], h;
for(new i = 0; i<MAX_HOUSES; i++)
{
format(file, sizeof(file), "Houses/%d.ini", i);
if(!dini_Exists(file))
{
h = i;
}
}
format(file, sizeof(file), "Houses/%d.ini", h);
if(!dini_Exists(file))
{
dini_Float(file, "EnterX");
dini_Float(file, "EnterY");
dini_Float(file, "EnterZ");
dini_Int(file, "Pickup");
dini_Float(file, "ExitX");
dini_Float(file, "ExitY");
dini_Float(file, "ExitZ");
dini_Int(file, "Interior");
}
CreatePickup(HouseInfo[h][hPickup], 1, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ], 0);
return 1;
}