[Tutorial] [Improved Tutorial] Mini Games System.
#1

Mini Games ( GameMode Changing System )

A little Introduction: This is a system of changing missions, gamemodes etc. Works as a map changing system.

Without wasting time. We are directly going to create this system.

In first we need a variable. In which we will be able to store our time.


pawn Code:
new timer 300000;
Quote:
Originally Posted by Wiki SA-MP
A variable is basically a bit of memory, it's where data is stored and can be changed and read as required. Variables are one or more cells, a cell is 32 bits (4 bytes) big and by default signed so they can store from -2147483648 to 2147483647 (although -2147483648 is poorly defined in PAWN and gives odd results if displayed). A variable made from more than one cell is called an array, strings are a special type of array where each cell holds a character of the string (or 4 characters in packed strings, but they're not covered here).
When ever you are using timer. You have some knowledge on how to use timer in pawno.
This is not like the time which we are using in our daily life. In pawno, 1 second = 1000 value.
And from this law. 5 mins equals to 300000 value.
You can calculate the values by click the link below.


Click Here To Calculate.

Coming to next step. In this we have to declare a callback. Which will work to change the gamemode to whatever you want.

pawn Code:
forward OnGameChange();
Quote:
Originally Posted by Wiki SA-MP
All public functions must be forwarded. That is a rule of Pawn. If you do not forward a public function, you will receive warnings from the compiler. It's best to forward a function at the top of the script (but below the #include directives, though).
Coming to third and very important step. Which is to make the callback.

pawn Code:
public OnGameChange()
{
   SendRconCommand("changemode (Your Next GM)");
}
I think I don't need to explain callback but you are using this in every step of pawno.
What SendRconCommand do?. It will send a command to the server. If you set "gmx" then it will restart. If you set "(un)load fs" this will load and unload fs.
But when you add any name after changemode like "changemode grand larceny". This will restart the gamemode and after restarting it will convert the gamemode of the server to the given name.

Coming to the fourth and final step. Which is to call the function which we have made in previous steps.

pawn Code:
SetTimer("OnGameChange",timer,false);
Quote:
Originally Posted by Wiki SA-MP
Sets a timer to call a function after some time.
What is timer?. This is the variable which we have created in the first step. If you don't want to use variable then you have to remove "timer" to the minutes and seconds you want. Always remember the law which I show you in the first step. That is 1 second = 1000 value.
Note: This is to be used in OnGamemodeInit. Because your mission starts on every gamemode start
.
-----------------------

A important thing that I think i didn't told you is that you have to repeat this process in every gamemode to make a changing chain. And in the last mission or gamemode you have to write this.
pawn Code:
SendRconCommand("changemode (Your First Gamemode Name)");
__________________________________

Please Read the tutorial Carefully because I don't want your server to be bugged.
Please Leave Feedbacks. What you like and what you don't like.

Reply
#2

This won't work, did you even test it?
you should do #define Timer 3000000 not new timer 300000;
secondly its changemode not gmx rcon command
Reply
#3

Thanks for reply. And thanks for reporting my mistake. After publishing this tutorial. I didn't repeated it.
If you don't want to use timer or the timer is not working then use 300000 instead of timer in gamemodeinit. I already told that in tutorial.
Reply
#4

It's only a starterЎ
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)