How to Put a [FS] in a gamemode
#1

I got a host 24/7 and some times when i /gmx the server crashes because of my 2 filterscripts. I got told to put the [FS] in the gamemode can some one tell me how please?

and can some one tell me how to add midiostream i tryed but it didn't work..
Reply
#2

wow.

copy then ctrl+c then in game ctrl+v

of simpler

copy right click copy go in gamemode right click paste.
Reply
#3

Quote:
Originally Posted by Kar
wow.

copy then ctrl+c then in game ctrl+v

of simpler

copy right click copy go in gamemode right click paste.
But PASTE WHERE IN THE GAMEMODE? which section?
Reply
#4

Eh, the same sections as it was in the FS?
Reply
#5

OnFilterScriptInit() part goes into OnGameModeInit() and same with exit.

All the other callbacks are the same for FSs and GMs. Put the code in the same callback names.
Reply
#6

it's not compiling i am doing some thing wrong:

this is the FS i am trying to add:

Код:
*
* Clock Real Time - Created by Noredine - Licence GPLv3
*/
 
#include <a_samp>
 
forward clock();
forward clock2();
 
new Text:Clock;
new clockcreated = 0;
 
public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Clock by HP Loaded           ");
    print("--------------------------------------\n");
    return 1;
}
 
public OnFilterScriptExit()
{
    return 1;
}
 
public OnPlayerSpawn(playerid){
    clock();
}
 
public clock(){
    new hour,minute,second;
    new string[256];
    gettime(hour,minute,second);
    if (minute <= 9) {
        format(string,25,"%d:0%d",hour,minute);
    }
    else {
        format(string,25,"%d:%d",hour,minute);
    }
    
    if (clockcreated == 0) {
      clockcreated = 1;
        Clock = TextDrawCreate(546.0, 23.0, string);
        TextDrawLetterSize(Clock, 0.5, 1.9);
        TextDrawFont(Clock, 3);
        TextDrawSetOutline(Clock, 2);
        TextDrawShowForAll(Clock);
    }
    else {
    
    }
    SetTimer("clock2",1000,1);
    return 1;
}
 
public clock2(){
    new hour,minute,second;
    new string[256];
    gettime(hour,minute,second);
    if (minute <= 9) {
        if (second <= 9) {
            format(string,25,"%d:0%d:0%d", hour, minute, second);
        }
        else {
            format(string,25,"%d:0%d:%d",hour,minute, second);
        }
    }
    else {
        if (second <= 9) {
            format(string,25,"%d:%d:0%d", hour, minute, second);
        }
        else {
            format(string,25,"%d:%d:%d",hour,minute, second);
        }
    }
 
    if (clockcreated == 1) {
      TextDrawSetString(Clock, string);
    }
    TextDrawShowForAll(Clock);
    return 1;
}
Reply
#7

pawn Код:
// ONTOP OF YOUR SCRIPT
forward clock();
forward clock2();
 
new Text:Clock;
new clockcreated = 0;

// UNDER ONGAMEMODEINIT
    print("\n--------------------------------------");
    print(" Clock by HP Loaded           ");
    print("--------------------------------------\n");

// UNDER ONPLAYERSPAWN
    clock();

// ANYWHERE, BUT NOT INSIDE ANY OTHER "public" FUNCTION. Like the very bottom of your script
public clock(){
    new hour,minute,second;
    new string[256];
    gettime(hour,minute,second);
    if (minute <= 9) {
        format(string,25,"%d:0%d",hour,minute);
    }
    else {
        format(string,25,"%d:%d",hour,minute);
    }
   
    if (clockcreated == 0) {
      clockcreated = 1;
        Clock = TextDrawCreate(546.0, 23.0, string);
        TextDrawLetterSize(Clock, 0.5, 1.9);
        TextDrawFont(Clock, 3);
        TextDrawSetOutline(Clock, 2);
        TextDrawShowForAll(Clock);
    }
    else {
   
    }
    SetTimer("clock2",1000,1);
    return 1;
}
 
public clock2(){
    new hour,minute,second;
    new string[256];
    gettime(hour,minute,second);
    if (minute <= 9) {
        if (second <= 9) {
            format(string,25,"%d:0%d:0%d", hour, minute, second);
        }
        else {
            format(string,25,"%d:0%d:%d",hour,minute, second);
        }
    }
    else {
        if (second <= 9) {
            format(string,25,"%d:%d:0%d", hour, minute, second);
        }
        else {
            format(string,25,"%d:%d:%d",hour,minute, second);
        }
    }
 
    if (clockcreated == 1) {
      TextDrawSetString(Clock, string);
    }
    TextDrawShowForAll(Clock);
    return 1;
}
Reply
#8

Showing the FS you are trying to add won't help anything.
1) You need to put the "new" things under the inlcudes in your GM.
2) Do same with the orwards.
3) Put clock(); under OnPlayerSpawn in the GM.
4) The rest can be put anywhere at the bottom of the script. (Note: Your functions shouldn't be under any callback like OnPlayerSomething)
5) You also need the Textdraw code like TextDrawCreate and the rest under OnGameModeInit (if any).
Reply
#9

Na it's okay that dude helped me a lot by reposting my FS i wanted to add it worked =] Thanks mate
Reply
#10

Yes I did notice it, but I finished typing that post so I decided to post it anyways.
Cheers.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)