House Making.
#1

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?
Reply
#2

I try it works!
Reply
#3

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.
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)