Paste Description for GMCycle FS
Rotate as many gamemodes as you want!
- GMCycle FS
- Sunday, September 30th, 2007 at 11:16:36pm MDT
- #include <a_samp>
- #define FILTERSCRIPT
- #define File_To_Read "gmcycle.txt"
- new counter = 1; // Because we are running on gamemode0 at init.
- new gmcount = 0;
- forward GameModeExitEx();
- forward GMCycleExists();
- public OnFilterScriptInit()
- {
- print(" Unlimited Gamemode Cycle by Ramjet loaded.");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print(" Unlimited Gamemode Cycle by Ramjet unloaded.");
- return 1;
- }
- // Our public function called remotely.
- public GameModeExitEx()
- {
- // Declare and initialise variables.
- gmcount = GetGamemodeCount();
- new string[256];
- new File:filename = fopen(File_To_Read, io_readwrite);
- // Start the fille processing.
- if(filename)
- {
- new i;
- while(fread(filename, string, 256))
- {
- // The mode we want to change to.
- if(i == counter)
- {
- new temp[256];
- StripNewLine(string);
- format(temp, sizeof(temp), "changemode %s", string);
- SendRconCommand(temp);
- counter++;
- break;
- }
- // We want to go back to gamemode0, so we will reset counter and reset the function.
- if(i == gmcount - 1)
- {
- counter = 0;
- fclose(filename);
- GameModeExitEx();
- }
- i++;
- }
- fclose(filename);
- }
- return 1;
- }
- /**
- * Strips Newline from the end of a string.
- * Idea: Y_Less, Bugfixing (when length=1) by DracoBlue
- * @param string
- */
- stock StripNewLine(string[])
- {
- new len = strlen(string);
- if (string[0]==0) return ;
- if ((string[len - 1] == '\n') || (string[len - 1] == '\r'))
- {
- string[len - 1] = 0;
- if (string[0]==0) return ;
- if ((string[len - 2] == '\n') || (string[len - 2] == '\r')) string[len - 2] = 0;
- }
- }
- GetGamemodeCount()
- {
- new File:filename = fopen("gmcycle.txt", io_readwrite), temp[256], i;
- if(filename)
- {
- while(fread(filename, temp, 256)) i++;
- fclose(filename);
- }
- return i;
- }
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.