06.07.2010, 02:19
In the global vars section of your game mode (where MAX_HOUSES is defined) add
As a house is created, you need to add it to the Houses itter by doing:
House ID of course being whatever you are using to identify the house ID (that is purely an example, make sure you have the houseid var defined if you use it that way).
If you delete or remove a house you must do:
You do not want a house id (or id # for that matter) to double-up in a foreach itter. I speak from experience here. Your server will hit an endless loop and go to 99.9% cpu use.
When you want to loop that Houses itter you would do:
Hope that helps. I can expound further on 2D itters though I don't think you'll need that here. 2D itters can be a monster to deal with.
pawn Code:
Itter_Create(Houses,MAX_HOUSES);
pawn Code:
Itter_Add(Houses,houseid);
If you delete or remove a house you must do:
pawn Code:
Itter_Remove(Houses,houseid);
When you want to loop that Houses itter you would do:
pawn Code:
foreach(Houses,i)
{
//Insert code here
}