[FS|INC] GMCycle - Gamemode Rotation without bounds.
#1

GMCycle
Rotate as many gamemodes as you want!

Introduction :

GMCycle is a method of cycling as many gamemodes as you want. Currently, you are restricted to 16 gamemode choices (gamemode0 - gamemode15), but with this script you can use as many as you need. This howto is aimed at intermediate scripters.

It is very important that you read all the detail below, to fully understand how the script works.


The Filterscript :

The GMCycle filterscript is there to do all the calculation, it checks which gamemode should be running where, and put it into the correct order. Every time GameModeExit() is called, the include, which I will explain in the next section, bypasses the regular GameModeExit() native to call the scripts main function, GameModeInitEx() remotely.


The Include :

The a_samp.inc include houses out native for GameModeExit(). We need to change values in here, as they would be already defined if we tried to use them in our own include. In order to get GameModeInitEx() to be called, we have to edit the way it is accessed.

We will change:
pawn Код:
native GameModeExit();
To:
pawn Код:
native r_GameModeExit() = GameModeExit;
stock GameModeExit() CallRemoteFunction("GameModeExitEx", "");
So we can call the function. Of course, if you aren't running the filterscript when you try and call GameModeExit(), you are going to have problems.

Once you have the include changed, you must recompile all scripts you want to use with the script, or it will call the original native.

As IJzerenRita pointed out below, you can use a #define to get the job done also, this means you don't have to touch the include, but you need to add it to all the gamemodes you want to use.

Quote:
Originally Posted by IJzerenRita
Instead of changing the .inc, which could cause problems when compiling a "regular" game mode, you could add a #define like so:
pawn Код:
#define GameModeExit() CallRemoteFunction("GameModeExitEx", "")
This will replace any GameModeExit() call with the remote function call. You can add this define to the game mode you like to work with GMCycle.
The List of gamemodes :

I have not added support for multiple sessions of the same gamemode, as this can be done scriptwise anyhow. By default, your file to read from should be "/scriptfiles/gmcycle.txt." Please set it out like so:

Quote:

lvdm
sftdm
cng
area51

Replacing the gamemode names with whatever way you want, however you want. If you make a mistake with the spelling, again, your gonna have problems .


Downloads :

Filterscript (Pastebin)
a_samp.inc (Pastebin)

Cheers,
Ramjet.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)