Jump to content
  • 0

Whats the best and most comum way to...


djlobo

Question

Whats the best and most comum way to change from one "game" to other?

I have noticed a few problems on some resources loading, and so far we didnt get any error from the debug script what makes me believe thats some kinda of non bug on loading on our current way.

On our server we use:

call(getResourceFromName("Mapmanager"), "changeGamemode",getResourceFromName(NextMode))

to change from one game to other, however its extremely rare but, sometimes the .map file seems to dont not load *( or even the teams ).

My question is: whats the most comum way to change from one resource to other? *( we have a folder for each game with: gamemode-client.lua , gamemode-server.lua , gamemode.map and meta.xml ).

(PS1:Just a note that our server loads around 25 diferent folders with the content mentioned abvoe ( same names on .lua files but diferent folder names )

(PS2: Im getting desperate :S )

Link to comment

9 answers to this question

Recommended Posts

  • 0

Whats the best and most comum way to change from one "game" to other?

I have noticed a few problems on some resources loading, and so far we didnt get any error from the debug script what makes me believe thats some kinda of non bug on loading on our current way.

On our server we use:

call(getResourceFromName("Mapmanager"), "changeGamemode",getResourceFromName(NextMode))

to change from one game to other, however its extremely rare but, sometimes the .map file seems to dont not load *( or even the teams ).

My question is: whats the most comum way to change from one resource to other? *( we have a folder for each game with: gamemode-client.lua , gamemode-server.lua , gamemode.map and meta.xml ).

(PS1:Just a note that our server loads around 25 diferent folders with the content mentioned abvoe ( same names on .lua files but diferent folder names )

(PS2: Im getting desperate :S )

Link to comment
  • 0
bool changeGamemode ( resource newGamemode, [ resource mapToLoadWith ] )

Changes the gamemode to a new one, optionally specifying an initial map for it (will load without a map by default).

Here's your problem, you are not specifying a map to load with your gamemode switch. It'll load without a map.

The current most common way is with the votemanager resource. If you don't want to use it, the mapcycler resource provides the functionality you want, you just need to provide it with gamemode/map rotation. Details on the maplimits wiki page.

If you want to stick to your scripting option, I recommend using

table getMapsCompatibleWithGamemode ( [ resource theGamemode ] )

and then choosing one at random to insert into changeGamemode.

Link to comment
  • 0
bool changeGamemode ( resource newGamemode, [ resource mapToLoadWith ] )

Changes the gamemode to a new one, optionally specifying an initial map for it (will load without a map by default).

Here's your problem, you are not specifying a map to load with your gamemode switch. It'll load without a map.

The current most common way is with the votemanager resource. If you don't want to use it, the mapcycler resource provides the functionality you want, you just need to provide it with gamemode/map rotation. Details on the maplimits wiki page.

If you want to stick to your scripting option, I recommend using

table getMapsCompatibleWithGamemode ( [ resource theGamemode ] )

and then choosing one at random to insert into changeGamemode.

Link to comment
  • 0
bool changeGamemode ( resource newGamemode, [ resource mapToLoadWith ] )

Changes the gamemode to a new one, optionally specifying an initial map for it (will load without a map by default).

Here's your problem, you are not specifying a map to load with your gamemode switch. It'll load without a map.

The current most common way is with the votemanager resource. If you don't want to use it, the mapcycler resource provides the functionality you want, you just need to provide it with gamemode/map rotation. Details on the maplimits wiki page.

If you want to stick to your scripting option, I recommend using

table getMapsCompatibleWithGamemode ( [ resource theGamemode ] )

and then choosing one at random to insert into changeGamemode.

But using the actual way we use, when it loads the resource, inside have a meta.xml

This is not valid?( please notice it sometimes load, and sometimes not its random )

Link to comment
  • 0
bool changeGamemode ( resource newGamemode, [ resource mapToLoadWith ] )

Changes the gamemode to a new one, optionally specifying an initial map for it (will load without a map by default).

Here's your problem, you are not specifying a map to load with your gamemode switch. It'll load without a map.

The current most common way is with the votemanager resource. If you don't want to use it, the mapcycler resource provides the functionality you want, you just need to provide it with gamemode/map rotation. Details on the maplimits wiki page.

If you want to stick to your scripting option, I recommend using

table getMapsCompatibleWithGamemode ( [ resource theGamemode ] )

and then choosing one at random to insert into changeGamemode.

But using the actual way we use, when it loads the resource, inside have a meta.xml

This is not valid?( please notice it sometimes load, and sometimes not its random )

Link to comment
  • 0

While your meta file is in an odd order compared to most, everything is there and correct, so I don't think there's a problem with that.

You can load map files contained within the same resource as a gamemode - it's not ideal, a gamemode and its maps should be separate resources, but it does work fine.

The problem may be that a gamemode does not get unloaded correctly. Next time it happens, check which resources are currently running.

You can check on the resources tab of the admin panel, or the web admin page if elementbrowser or resourcebrowser is running.

You may find that there is a bug in one of the gamemodes that is stopping it from unloading or cleaning up properly.

Otherwise, the problem will likely be starting a new gamemode from within a gamemode. Instead, trigger a votemap or trigger the round end event and use the mapcycler to advance through your gamemodes.

https://wiki.multitheftauto.com/wiki/Res ... otemanager

https://wiki.multitheftauto.com/wiki/Resource:Mapcycler

I'll admit I'm grasping at straws a little, it is a bit odd for a gamemode not to load its map file.

Link to comment
  • 0

While your meta file is in an odd order compared to most, everything is there and correct, so I don't think there's a problem with that.

You can load map files contained within the same resource as a gamemode - it's not ideal, a gamemode and its maps should be separate resources, but it does work fine.

The problem may be that a gamemode does not get unloaded correctly. Next time it happens, check which resources are currently running.

You can check on the resources tab of the admin panel, or the web admin page if elementbrowser or resourcebrowser is running.

You may find that there is a bug in one of the gamemodes that is stopping it from unloading or cleaning up properly.

Otherwise, the problem will likely be starting a new gamemode from within a gamemode. Instead, trigger a votemap or trigger the round end event and use the mapcycler to advance through your gamemodes.

https://wiki.multitheftauto.com/wiki/Res ... otemanager

https://wiki.multitheftauto.com/wiki/Resource:Mapcycler

I'll admit I'm grasping at straws a little, it is a bit odd for a gamemode not to load its map file.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...