fodev.net

FOnline Development => Questions and Answers => Topic started by: GecKoTDF on August 30, 2016, 03:52:35 pm

Title: Remote Admin
Post by: GecKoTDF on August 30, 2016, 03:52:35 pm
Hi guys, I was building a server and find in the config file a "Remote Admin Port" it's in 0 by default - I try to change it to another port, and the put this port in the client or something like that but not work - It's posible to get a remote admin control? Not loged in the game? or that config it's just a forget function ?
Title: Re: Remote Admin
Post by: Wipe on August 30, 2016, 07:07:23 pm
If you want control without being logged ingame, why do you try to connect with a client? :P
Title: Re: Remote Admin
Post by: GecKoTDF on August 30, 2016, 07:22:27 pm
Jaja well I mean a remote admin without enter the game, I check the client you can change de port - I was imagine if you put the port of the "Admin panel" you don't load the game just a console to send commands or stuff like that but I believe its impossible - And there's no information about the admin panel port or how to log using that port.-
Title: Re: Remote Admin
Post by: Wipe on August 30, 2016, 09:16:03 pm
Just use telnet, connect, and type password. Then just use hardcoded ~commands like you'd do in client after getaccess -- be warned lot of them won't work :P

In my opinion it ain't worth it... some of design choices are silly, annoying, or simply dangerous; but hey, it's just me.
Title: Re: Remote Admin
Post by: GecKoTDF on August 30, 2016, 09:30:01 pm
Ahhh you are the best! - Great well I know its probably a "beta" of that but its a good option have a possible telnet connection for any quick access.-

By the way, there's a way to send a Global Message in admin mode? Like... "~say_global Hello" something like that
Title: Re: Remote Admin
Post by: Wipe on August 31, 2016, 02:22:35 am
No. None of hardcoded commands can be (ab)used to pass strings~

If you know bit C++ you can check my attempt on admin panel via dll, which one of purposes was to bypass exactly this limitation; never had a chance to test it on live server so beware :P Everything is in here (https://github.com/rotators/fo2238/blob/master/Server/extensions/DevConnect) and here (https://github.com/rotators/fo2238/blob/master/Server/scripts/devconnect.fos), except actual starting whole thing, which should be done by calling InitDevConnect(port) in main@init and ProcessDevConnect() in main@loop.

Highly experimental, untested, unsafe (if you don't modify dev_login() function), probably bit slow... but at least you can edit it any way you like and -most important i think- it's prepared for two-way communication and tied to game scripts, instead of hardcoded commands (which can, in most cases, be simulated by scripts anyway).
Luckily, that's really small amount of code so it should be pretty easy to understand for anyone who worked with fonline dlls before.
Title: Re: Remote Admin
Post by: GecKoTDF on August 31, 2016, 04:37:03 am
I see, so by default there's no way to send a message if you are and admin in a "global" way to all connected users ? -
Title: Re: Remote Admin
Post by: Wipe on August 31, 2016, 08:39:08 am
Best i can think of is - predefined messages with assigned id numbers and ~run command which sends them (by providing message id as one of params)
Title: Re: Remote Admin
Post by: GecKoTDF on August 31, 2016, 03:09:03 pm
That exactly what i mean Wipe - Im a noob in coding, but you can give me an example of predefined message and how to call it?
Title: Re: Remote Admin
Post by: Wipe on September 01, 2016, 02:34:32 am
It can be anything as simple as
Code: [Select]
void msg( Critter&, int, int, int type )
{
   string msg;
   if( type == 1 )
       msg = "Yay!";
   else if( type == 2 )
       msg = "Wee!";
   else
       return;
   array<Critter@> players;
   for( uint p=0, pLen=GetAllPlayers(players); p<pLen; p++ )
   {
         players[p].Say( SAY_NETMSG, msg );
   }
}
and called as ~run some_modulke msg 0 0 1
Oh, and remember to never access Critter object in any function called from admin panel... In best case it will result in script exception, in worst - server crash (don't remember AS behaviour now)
Title: Re: Remote Admin
Post by: JovankaB on September 01, 2016, 06:20:40 am
Can't you just send ascii values with ~run commands one by one, store them in a buffer and then a special command to "show whole message"? :D

And then modify the admin panel to make this automatically, you just write "say hello" and the panel sends all necesary ~run commands
Title: Re: Remote Admin
Post by: Wipe on September 01, 2016, 03:46:31 pm
Technically yes, but!

Taking all the problems together - general idea is nice, but as you can see it works only on paper. Please address mentioned issues when updating your suggestion.

Sincerely,
#Rotators
Title: Re: Remote Admin
Post by: JovankaB on September 02, 2016, 12:09:53 pm
Taking all the problems together - general idea is nice, but as you can see it works only on paper.

Phew, it would work in reality too! - just not 100% of the time :P
Title: Re: Remote Admin
Post by: GecKoTDF on September 03, 2016, 05:11:46 am
Hi Wipe,

Well I made a few test but no luck - Im sure im doing something wrong, I copy the code and create a .fos file call it "text" and save it into script folder of the server then load that in script.cfg like "@ server module text" and no luck fail to start the server say "'SAY_NETMSG' is not declared" then try to load id in "_scripts.fos" the server load but in the "chat" I type "run text msg 0 0 1" and still no luck to made it work.-

Im wrong in the load of the code?
Title: Re: Remote Admin
Post by: Wipe on September 04, 2016, 10:52:54 am
Just include _defines.fos (and get used to that, that file is required for virtually everything)
Title: Re: Remote Admin
Post by: GecKoTDF on September 04, 2016, 05:31:18 pm
Hell Yeah! work like a charm - Thank you very much Mr. Wipe! - Now understand a bit more the lenguage of the motor.-

Now another question about the server admin - For example when you launch FOnlineServer.exe you can create a batch who clear the temporary files, and with -start open the .exe and do a automatic start of the server.-

But looking at the lenguage, its possible to create a script with a 24 timer for example or at certain hour of the actual day - Do this:

- Save WorldMap
- Execute a .bat file ?

Because it's this is posible when you call the msg 0 0 1 check a .txt file, see the information in line 1 and thats the message - This give you the chance to change the message without restart the server

Title: Re: Remote Admin
Post by: Wipe on September 08, 2016, 12:47:17 am
You could, i guess. It really sounds like reverse of our solution to redirect +requesthelp messages to IRC channel.

Basic idea is to store each message somewhere in server folder and frequently checking them. That's where  you need AS extension to collect filenames in given directory, pass a list back to scripts, open and process messages and back dll which deletes processed files. Easy.

Here (http://angelcode.com/angelscript/sdk/docs/manual/doc_register_api_topic.html) you can read about how to add new functions to scripts, and i'm sure there are some examples on creating own dlls somewhere in SDK. Remember to keep server<->outside communication as fast as possible or you will end with pretty lagging server :)