Removing a building FOR A PLAYER will not work under the OnGameModeInit callback since there are no players connected when initializing the gamemode.
There are a few exceptions where RemoveBuildingForPlayer can be used upon initializing a script and that is in filterscripts and when restarting the gamemode through gmx (I don't recommend doing so, though). You can load filterscripts at run-time and not necessarily when the server starts. In such a case (*) (which I don't think is very common), you can loop through all the connected players:
PHP код:
public OnFilterScriptInit() {
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i ++) {
RemoveBuildingForPlayer(i, ...); // Fill in the rest of the arguments
}
return true;
}
A downside of doing it like this is that players who join the server after the filterscript has been initialized still see the removed buildings. To fix that, you can add the OnPlayerConnect callback to the filterscript and remove the buildings in there:
PHP код:
public OnPlayerConnect(playerid) {
RemoveBuildingForPlayer(playerid, ...); // Fill in the rest of the arguments
return true;
}
(*) I don't mean loading filterscripts at run-time but removing buildings for a player at run-time.