Checking if a house is vaild from a random string
#2

In OnGameModeInit callback, you should load the houses. Use a global variable and reset it before you load the houses. After you're done with the loading, assign the value of the last houseid + 1 to that variable.
pawn Код:
// At some callback
{
    LoadedHouses = 0;
   
    for(new h = 0; h < MAX_HOUSES; h++)
    {
        // loading...
        if( .. id does not exist .. )
        {
            LoadedHouses = h + 1;
            break;
        }
    }
    return 1;
}
Then you can simply do
pawn Код:
new RandomHouseID = random(LoadedHouses);
Reply


Messages In This Thread
Checking if a house is vaild from a random string - by AccountName - 01.06.2013, 11:28
Re: Checking if a house is vaild from a random string - by Konstantinos - 01.06.2013, 11:35
Re: Checking if a house is vaild from a random string - by AccountName - 01.06.2013, 11:38
AW: Checking if a house is vaild from a random string - by Skimmer - 01.06.2013, 11:38
Re: AW: Checking if a house is vaild from a random string - by Konstantinos - 01.06.2013, 11:41

Forum Jump:


Users browsing this thread: 1 Guest(s)