Jump to content

[Question & Suggestion] Serverside Scripts


ThunderDodge

Recommended Posts

Hey,

 

i would like to know why 'deferredCallback' does not work on serverside stuff ( "server.lua" ).

I'd like to add my autorestart script, wich initializes, but 'deferredCallback' returns always '0'.

The Script just works fine, when i attach it to a Player() or Entity().

I already thought about a Object in the world, wich i can attach script to, that makes some serverside calculations. But thats not a smart solution.

Does anyone know how to do it on the right way?

 

I came up with some suggestion's for the Scripting-API:

 

[serverside - Server functions]

Galaxy():getSectos()		--returns table with all sectors [posX,posY,Seed]
Galaxy():getSector( seed or pos )		-- returns a specified Sector, to attach scripts to it.
Server():think()		-- executes every x seconds ( depends on server tickrate )
Server():getUserGroup( player )   -- returns the name of the player's user group ( Moderator, Administrator... )
Server():userGroupInfo( name )  -- returns table of privileges of the user group ( commands and stuff )
Server():getPlayerPing( player )  -- returns the ping of the given player

[Player functions]
Player():ping()   - get the players ping



[Entity functions]

Entity():setPos( x, y, z )
Entity():getPos()	-- Returns Vector or table with coordinates
Entity():moveToSector( sector info (coordinates) )	-- Moves the entity in a different sector, that already exists
Enity():setAngles( Angle vector )
Entity():getAngles()	-- gets the angles of the entity

 

 

If im wrong with something, please tell me.

Thanks

 

Link to comment
Share on other sites

Regarding autorestart script for server inside the in game script:

 

But putting server restarting script into the server itself is a bad design. There are tools that allows you to schedule tasks on most OSes. Using external scripts to manage server is easier to use and to configure, is more secure and more fault proof.

Link to comment
Share on other sites

I want to give some messages to the player like:

"Restart in x seconds, Minutes, Hours"

 

That isn't possible with a external script. I would do it external, wjich is pretty easy, but then i don't have the messages.

I mean, such a small script, wouldn't do much to server performance.

 

 

Some other solution would be, you have set restarting times, like 3am, 6am, 12am, 2pm, 4pm....

But i want to make it lua side, just because i always did that on my modification's in modable games.

 

 

Link to comment
Share on other sites

I want to give some messages to the player like:

"Restart in x seconds, Minutes, Hours"

 

That isn't pissble with a external script. I would do it external, wich is pretty easy, but then i dont have the messages.

I mean, such a small script, wouldn't do much to server performance.

 

 

Some other solution would be, you have set restarting times, like 3am, 6am, 12am, 2pm, 4pm....

But i want to make it lua side, just because i always did that on my modification's in modable games.

 

I am still learing my way around my server but couldnt you create an event script that posts your message in chat and set it to go off before your server job restarts the game server?

Link to comment
Share on other sites

I want to give some messages to the player like:

"Restart in x seconds, Minutes, Hours"

 

That isn't possible with a external script. I would do it external, wich is pretty easy, but then i dont have the messages.

I mean, such a small script, wouldn't do much to server performance.

 

But that is possible. You can send CLI commands to server console in e.g. tmux.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...