SA-MP Forums Archive
Load filterscript on Gamemode restart - 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: Load filterscript on Gamemode restart (/showthread.php?tid=154079)



Load filterscript on Gamemode restart - Galcio - 12.06.2010

Hi. I wonder if it's possible to load a certain filterscript when I restart my gamemode in-game with a command like this;
pawn Code:
if(strcmp(cmd, "/gmx", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            if(PlayerInfo[playerid][pAdmin] >= 5)
            {
                GameModeRestart();
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command");
            }
        }
        return 1;
    }
And if that doesn't work, is it possible to make the gamemode quit by itself (the same way when you type "exit" in samp-server.exe) and then after a short time let it start again?

Thanks.


Re: Load filterscript on Gamemode restart - Zimon95 - 12.06.2010

Well, you can save a value into a file and read it in OnGameModeInit, if value is for example 0 don't load else SendRconCommand("loadfs blablabla");



Re: Load filterscript on Gamemode restart - TheInnocentOne - 12.06.2010

pawn Code:
SendRconCommand("gmx");
pawn Code:
SendRconCommand("loadfs filterscriptnamehere");



Re: Load filterscript on Gamemode restart - Galcio - 12.06.2010

My problem is that I use a car dealership (ping's one) as a filterscript like an add-on to my gamemode. When I restart the server in-game with the command I showed you the cars in the FS doesn't appear.

Quote:
Originally Posted by Zimon95
Well, you can save a value into a file and read it in OnGameModeInit, if value is for example 0 don't load else SendRconCommand("loadfs blablabla");
This would be the best way in solving this but I'm not really sure how to execute this.


Re: Load filterscript on Gamemode restart - DJDhan - 12.06.2010

Quote:
Originally Posted by TheInnocentOne
pawn Code:
SendRconCommand("gmx");
pawn Code:
SendRconCommand("loadfs filterscriptnamehere");
That wouldn't really work since all the FSs' are reloaded once the gamemode restarts. You should instead use

Code:
SendRconCommand("reloadfs filterscriptnamehere");



Re: Load filterscript on Gamemode restart - DJDhan - 12.06.2010

Quote:
Originally Posted by ·!¦[·MaykoX·
¦!· ]
You should also make timer.. otherways it will be useless.
Yes exactly.

Code:
if(strcmp(cmd, "/gmx", true,4) == 0)
{
	
	if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command");
	
	SendRconCommand("gmx");
	SetTimer("reloadfs",5000,0);
	return 1;
}


forward reloadfs();
public reloadfs()
{
	SendRconCommand("reloadfs filterscriptnamehere");
	return 1;
}






Re: Load filterscript on Gamemode restart - Galcio - 12.06.2010

Thanks for the help, I'm starting to understand this now. It doesn't work the way I want it to, though. Is it possible to use the functions mentioned above but instead I SendRconCommand("exit"); and with a timer I start the server again? I tried doing it but it failed hard. I'm almost certain this should work, seen it on numerous servers before.

pawn Code:
forward reloadgm();
----
if(strcmp(cmd, "/gmx", true) == 0)
{
   if(IsPlayerConnected(playerid))
   {
      if(PlayerInfo[playerid][pAdmin] >= 5)
      {
          SendRconCommand("exit");
          SetTimer("reloadgm", 5000, 0);
      }
bla bla bla
-----

public reloadgm()
{
   SendRconCommand("gmx");
   return 1;
}




Re: Load filterscript on Gamemode restart - DJDhan - 12.06.2010

That's not possible. In your code, you are closing down the server completely and then restarting it. It needs to be running to restart it.


Re: Load filterscript on Gamemode restart - KillermanGR - 10.02.2011

Quote:

C:\Users\Michael\Desktop\SA-MP SERVER\gamemodes\gf.pwn(26207) : warning 235: public function lacks forward declaration (symbol "OnPlayerPrivmsg")
C:\Users\Michael\Desktop\SA-MP SERVER\gamemodes\gf.pwn(26244) : error 021: symbol already defined: "SendRconCommand"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

this is what I get after adding SendRconCommand("loadfs blahblahblah");