Jump to content

Having a Vanilla Server with Additional Server-Side Commands


mikeyoh

Recommended Posts

Hi there!

 

I've managed to set up a dedicated server and had it running with a few friends hopping in. I'd like to know how I as an admin can create additional admin commands to simplify some of the things I do in debug mode. For example, is there a way I can type /addxp allplayers foraging=15000 to give every player on the server xp at once? Or for players to type in a command in chat to restore their skills? Or have a player drink from a water source to receive items?

 

I've never been a fan of modded server, and so I'd like to keep the server vanilla. I've gone to some vanilla servers that have server-side mods like claiming a car by typing in commands (non-admin). 

 

How does it work for vanilla servers exactly? I know for modded servers, you can communicate with client lua & server lua.

 

Thank you!

Link to comment
Share on other sites

As far as I am aware, it would not be possible to implement custom commands without specifically modding them in. Especially commands that would allow players themselves to put in chat commands. Since both the server and player clients would need to understand the commands, which only mods can do for now, since mods are installed both in the client and server.

Link to comment
Share on other sites

52 minutes ago, Beard said:

As far as I am aware, it would not be possible to implement custom commands without specifically modding them in. Especially commands that would allow players themselves to put in chat commands. Since both the server and player clients would need to understand the commands, which only mods can do for now, since mods are installed both in the client and server.

Thanks for getting back so quick!

 

I have gone to vanilla servers where the server seems to do some interesting things without needing to download mods on client side. Sadly some of the the servers have gone offline. I've seen the servers allow players to type /claim inside a car to claim a car, or drink from a well to get a random item.

 

 

For example, with mods I can send trigger events from client to server

sendClientCommand("playerCommands", "GodHeal", {playerId = sourceId});

 

Then the server could execute the commands

local Commands = {};
Commands.playerCommands = {};

Commands.playerCommands.GodHeal = function(player, args)
 print(player:getUsername() .. " triggered a full heal.");
 -- the below doesn't work but idea is to get the playerID on server, and do a full heal somehow..
 player:getBodyDamage():RestoreToFullHealth();
 -- maybe player:setGodMod(true) followed by player:setGodMod(false) works? have not yet tried.
end

local onClientCommand = function(module, command, player, args)
 if Commands[module] and Commands[module][command] then
 Commands[module][command](player, args);
 end
end

Events.OnClientCommand.Add(onClientCommand);

 

But I'm having a difficult time getting the things to execute on console/server-side only without the use of mods.

 

I'm thinking maybe I can listen to the logs for whenever someone types in general chat "Got message:ChatMessage{chat=General, author='admin', text='GodMod Heal Me!'}." then I could somehow trigger the command /godmod "admin" -true followed by /godmod "admin - false. That doesn't answer how the servers I've been on make drinking from a water well spawn item in the player's inventory because the log doesn't keep track of players drinking. Or how the server allows player to type /claim to claim a vehicle.

 

Thank you

Link to comment
Share on other sites

You would likely be able to do it with scripts if you just want to do a simple godmode command. But the servers that you have been on most likely just use mods to spawn in items from wells, as that would be quite simple to do once you have access to modding.

Link to comment
Share on other sites

1 hour ago, Beard said:

You would likely be able to do it with scripts if you just want to do a simple godmode command. But the servers that you have been on most likely just use mods to spawn in items from wells, as that would be quite simple to do once you have access to modding.

How do I listen to client side events to trigger the script? 
 

I guess those servers have server-side mods? I think my goal is just to keep a vanilla server so new players don't need to install any mods on their end. Are there any guide on creating server only mods? 
 

Thank you

Link to comment
Share on other sites

I am pretty sure the action you described requires both a server side and client side mod, since the client needs to know that a well has a new action, and the server then needs to allow for that action to happen and spawn an item.

You can likely get better information if you ask in the Modding channel on our Discord or on the forums here, as it would be less a Multiplayer specific question and more of a modding question at that point, which I do not have much experience with personally.

Link to comment
Share on other sites

5 hours ago, Beard said:

I am pretty sure the action you described requires both a server side and client side mod, since the client needs to know that a well has a new action, and the server then needs to allow for that action to happen and spawn an item.

You can likely get better information if you ask in the Modding channel on our Discord or on the forums here, as it would be less a Multiplayer specific question and more of a modding question at that point, which I do not have much experience with personally.

I'll head over and start a new thread.

 

Thank you for the help!

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