01.06.2013, 11:35
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.
Then you can simply do
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;
}
pawn Код:
new RandomHouseID = random(LoadedHouses);