To sum up a "callback" or function:
pawn Код:
public function()
{ // opener
// inside the callback
} // closer
What you basically did wrong was try to define a function that used playerid (RemoveBuildingForPlayer(playerid,) under OnFilterScriptInit, which does not have playerid defined.
This is the function for FilterScriptInit:
pawn Код:
public OnFilterScriptInit()
Playerid is defined inbetween the two brackets, that's why you put it OnPlayerConnect.
Quote:
public OnPlayerConnect(playerid)
|
I can't really explain it any better, but this pretty much sums it up. Also, if you are looking to do live updates (which translates to being able to update and remove mapping without restarting the server), add this to public OnFilterScriptExit().
pawn Код:
public OnFilterScriptExit()
{
for(new i=1;i<=MAX_OBJECTS;i++)
{
DestroyObject(i);
}
return 1;
}
This loops through all existing objects and deletes them when the Filterscript exits. To call this function, go ingame, login in to RCON
(/rcon login) and type
/rcon reloadfs name. This will exit the script (causing all objects to dissapear) and then open the script (public OnFilterScriptInit - which basically loads all objects (if you loaded them there). RemoveBuildingForPlayer will remain unaffected however.