Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: CA_RemoveBuilding : Map has already been initialized. Use this before CA_Init. #87

Open
Zorono opened this issue May 6, 2020 · 2 comments

Comments

@Zorono
Copy link

Zorono commented May 6, 2020

i had already removed those buildings using CA_RemoveBuilding before initializing using CA_Init under OnGameModeInit...
however, when i call the command gmx the whole server gonna crazy and gets full of ERROR: CA_RemoveBuilding : Map has already been initialized. Use this before CA_Init. errors...

as i am removing buildings again from the Database after Server restart so ColAndreas is already initialized and the Buildings is already removed... which is annoying

@NexiusTailer
Copy link
Contributor

Seems that either the plugin or you will have to somehow check whether this gamemode loading due to server restart or the server was started for the first time. I can recommend the following code on your part at the moment:

public OnGameModeInit()
{
    if(GetSVarInt("gmxCounter") == 0)
    {
        //Do your remove objects stuff
        CA_Init();
    }
    SetSVarInt("gmxCounter", GetSVarInt("gmxCounter") + 1);
    return 1;
}

@Crayder
Copy link
Collaborator

Crayder commented May 16, 2020

Yes for quite a few reasons this would not be changed. Deciding whether objects should be removed is up to the mode. Like, some servers literally use different modes. And filterscripts. TextureStudio for example could be broken by this if it was designed to also remove collisions, any map editor would. Or another example might be servers that debug or test with gmx, if changes were made to the collision stuff things could get messy. In all these cases the server variable example is probably best suited actually.

Think like a callback would be sufficient for what you need? Like, by default the CA_RemoveBuilding function could call "OnCollisionRemove" with parameters to know whether it failed or not. There would just be a parameter in CA_RemoveBuilding so that this call could be disabled (would speed up server load because less calls, if for example the callback had a lot of code in it for some reason). Similar callbacks for other things could be useful as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants