Wanting to delete an id from 0 to 100 then create the deleted id and after its created load from last place?
#1

Ok I basically want to create a few houses then when I delete one of the houses I can create the deleted houses id and then after it creates that ID it will continue from the last point created.

So for example I have 50 houses, I decided to delete house id 34. I then create a house in game and it will create house id 34 then when I create another it will be 51 then 52 then if I delete an other it will do the same?
Reply
#2

you can add a command when you create a house, i.e. house level or some other variable is set to 0, and when you create a house, it checks with a loop which first house level is 0. After checking which house id has type 0, it will create a house with that id.
Reply
#3

pawn Код:
#define MAX_HOUSES 100 // Change this to whatever the largest number of houses you can have on your server is.

stock GetNextHouseID()
{
    new file[40];
    for(new i = 0; i < MAX_HOUSES; i++)
    {
        format(file, sizeof(file), "Server\Houses\%d.ini", i); //Replace this with whatever the link to your house files are.
        if(fexist(file)) continue;
        return i;
    }
    return -1;
}
If you don't understand, show us some of the code where you create/load and save houses. Then I will be able to fully make it for you, this is just an example of what it should look like.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)