SA-MP Forum
February 09, 2010, 11:06:35 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Hosted tab listings available from serverFFS
 
   Home   Help Login Register  
Pages: [1] 2
  Print  
Author Topic: [FS|INC] GMCycle - Gamemode Rotation without bounds.  (Read 4472 times)
Ramjet.
Gangsta
****
Posts: 587


View Profile WWW
« on: October 01, 2007, 06:16:49 AM »

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 Code:
native GameModeExit();

To:
PAWN Code:
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.

Instead of changing the .inc, which could cause problems when compiling a "regular" game mode, you could add a #define like so:
PAWN Code:
#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 Smiley.


Downloads :

Filterscript (Pastebin)
a_samp.inc (Pastebin)

Cheers,
Ramjet.


« Last Edit: October 02, 2007, 02:39:24 AM by Ramjet. » Logged

Visit my website!




Quote from: #cp.clan
<&dugi> i thought that my signature would be original
<&dugi> but i noticed that simon has the same
elovric
High-roller
*****
Posts: 1230


View Profile
« Reply #1 on: October 01, 2007, 06:23:11 AM »

Well this is very good, i'm going to try it, good work.  Smiley
Logged

I'm not using this account anymore. If you want, contact me on new account -> Don Correlli.
[TGP]Evo
Gangsta
****
Posts: 517


View Profile WWW
« Reply #2 on: October 01, 2007, 06:23:56 AM »

Very nice ramjet  Smiley
Logged

ι'νє gσт ησ ωαу тσ ѕωιт˘нвα˘к
Maikel
High-roller
*****
Posts: 1144


View Profile
« Reply #3 on: October 01, 2007, 06:38:43 AM »

Nice
Logged
Alejandro
High-roller
*****
Posts: 1275


View Profile WWW
« Reply #4 on: October 01, 2007, 11:25:21 AM »

pretty nice.
Logged




Mi hielo tan brillante que usted piensa im congelación.
IJzerenRita
High-roller
*****
Posts: 1455


View Profile WWW
« Reply #5 on: October 01, 2007, 05:07:19 PM »

Instead of changing the .inc, which could cause problems when compiling a "regular" game mode, you could add a #define like so:
PAWN Code:
#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.
Logged

Quote
<Woet>   AND HE USES GMAIL
<Woet>   GOD
<Woet>   I WANNA MARRY HIM
Nate660
High-roller
*****
Posts: 1453



View Profile WWW
« Reply #6 on: October 01, 2007, 09:49:33 PM »

Nice ramjet!  I would just like to know what inspires you these good ideas  Wink
Logged

Eclipse RP Advertisement


(60) GB  PS3
games: Call of duty 4 - Need for speed prostreet - Sega ralley revo
Motorstorm - Madden 08 - Tony hawks project 8 - The Godfather
Mx VS Atv untamed

PSN:nate660
Ramjet.
Gangsta
****
Posts: 587


View Profile WWW
« Reply #7 on: October 02, 2007, 02:36:55 AM »

Instead of changing the .inc, which could cause problems when compiling a "regular" game mode, you could add a #define like so:
PAWN Code:
#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.

Hey that works! Thats for the tip Smiley. I decided to change the include as I don't see much reason why it shouldn't be running anyway (if you actually need to run more than 16 scripts). It won't cause problems when compiling a regular gamemode if you have GMCycle running, that was the point I was trying to make.

I'll add this tip to the post as it's more practical than editing the include I suppose.

Cheers,
Ramjet.
Logged

Visit my website!




Quote from: #cp.clan
<&dugi> i thought that my signature would be original
<&dugi> but i noticed that simon has the same
0rb
High-roller
*****
Posts: 4696



View Profile
« Reply #8 on: October 02, 2007, 04:39:14 AM »

Good idea and good work smiley
Logged
Killerkid.
Gangsta
****
Posts: 751



View Profile
« Reply #9 on: November 14, 2007, 02:06:59 PM »

Hello, My server crashes when the last mode starts. confused

Quote from: gmcycle.txt
Mode1
Mode2
Mode3
Mode4
Anything wrong?
Logged

X_Cutter
Gangsta
****
Posts: 776


View Profile WWW
« Reply #10 on: November 18, 2007, 02:40:12 PM »

what do I have to put in server.cfg (appart for filterscripts GMCyle ) . What Gamemode does it executes?
Logged

I am looking for a free host for West Side Stories San Fierro RPG (Still in beta). Hoster would get lvl5-admin. PM ME THE FASTER POSSIBLE!(I use Win32XP)


Please visit my website! @ freewebs.com/xcutter
There you can find my latest scripts such as XSquare and a Drug Dealing Addon!(Not released!)
X_Cutter
Gangsta
****
Posts: 776


View Profile WWW
« Reply #11 on: November 18, 2007, 05:12:46 PM »

what do I have to put in server.cfg (appart for filterscripts GMCyle ) . What Gamemode does it executes?
*BUMP*

I know this seems stupid but I really need to know... Lol
Logged

I am looking for a free host for West Side Stories San Fierro RPG (Still in beta). Hoster would get lvl5-admin. PM ME THE FASTER POSSIBLE!(I use Win32XP)


Please visit my website! @ freewebs.com/xcutter
There you can find my latest scripts such as XSquare and a Drug Dealing Addon!(Not released!)
0rb
High-roller
*****
Posts: 4696



View Profile
« Reply #12 on: November 18, 2007, 07:48:06 PM »

Read the first post?
Logged
X_Cutter
Gangsta
****
Posts: 776


View Profile WWW
« Reply #13 on: November 19, 2007, 04:11:28 AM »

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 Code:
native GameModeExit();

To:
PAWN Code:
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.

Instead of changing the .inc, which could cause problems when compiling a "regular" game mode, you could add a #define like so:
PAWN Code:
#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 Smiley.


Downloads :

Filterscript (Pastebin)
a_samp.inc (Pastebin)

Cheers,
Ramjet.


I readed this, and I don't see anything about server.cfg
Logged

I am looking for a free host for West Side Stories San Fierro RPG (Still in beta). Hoster would get lvl5-admin. PM ME THE FASTER POSSIBLE!(I use Win32XP)


Please visit my website! @ freewebs.com/xcutter
There you can find my latest scripts such as XSquare and a Drug Dealing Addon!(Not released!)
Ramjet.
Gangsta
****
Posts: 587


View Profile WWW
« Reply #14 on: November 19, 2007, 10:30:08 AM »

I readed this, and I don't see anything about server.cfg

Your powers of observation serve you well.

You need to add the filterscript to the filterscripts line. I assumed most people would understand this.


« Last Edit: November 19, 2007, 10:32:07 AM by Ramjet. » Logged

Visit my website!




Quote from: #cp.clan
<&dugi> i thought that my signature would be original
<&dugi> but i noticed that simon has the same
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF one | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!