Perhaps it laggs so much because of the timer ReadPlayerHouseData(playerid).
In that timer, you're looping through ALL houses (200 of them) for every player every second.
You're also checking if the file exists, so with 50 players online, you're checking if the housefile exist for 200 houses, multiplied with 50 players.
That's 200*50 = 10.000 checks on your harddrive every second.
Besides that, you're doing 10.000 distance checks too every second.
Wouldn't it be easier to use a streamer and setup 3DTextLabels at every house's location, instead of using this timer and displaying huge texts over the player's screen to inform him if this house is owned, and who's the owner?
Also, you have a bug in your OnFilterScriptInit callback:
pawn Код:
for(new i = 0; i <= MAX_PLAYERS; i++)
{
SetTimer("ReadPlayerHouseData", 1000, true);
}
You didn't supply the timer with a playerid parameter, so it would only work for playerid 0.
Use this if you want to keep that timer:
pawn Код:
for(new i = 0; i <= MAX_PLAYERS; i++)
{
SetTimerEx("ReadPlayerHouseData", 1000, true, "d", i);
}