SA-MP Forums Archive
How to Put a [FS] in a gamemode - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to Put a [FS] in a gamemode (/showthread.php?tid=155765)



How to Put a [FS] in a gamemode - Karl115 - 19.06.2010

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..


Re: How to Put a [FS] in a gamemode - Kar - 19.06.2010

wow.

copy then ctrl+c then in game ctrl+v

of simpler

copy right click copy go in gamemode right click paste.


Re: How to Put a [FS] in a gamemode - Karl115 - 19.06.2010

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?


Re: How to Put a [FS] in a gamemode - Naxix - 19.06.2010

Eh, the same sections as it was in the FS?


Re: How to Put a [FS] in a gamemode - DJDhan - 19.06.2010

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.


Re: How to Put a [FS] in a gamemode - Karl115 - 19.06.2010

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;
}



Re: How to Put a [FS] in a gamemode - Mike Garber - 19.06.2010

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;
}



Re: How to Put a [FS] in a gamemode - DJDhan - 19.06.2010

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).


Re: How to Put a [FS] in a gamemode - Karl115 - 19.06.2010

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


Re: How to Put a [FS] in a gamemode - DJDhan - 19.06.2010

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