Delete a player from the Server

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
Post Reply
doppelEben
Fast Inserter
Fast Inserter
Posts: 117
Joined: Thu Oct 27, 2016 6:21 am
Contact:

Delete a player from the Server

Post by doppelEben »

Hi there

We are currently facing the problem, that one player misses his armor. And due to high-tech-start with bots, we arent on the point we can reproduce the armor easily(much higher tier). So I am looking for a way to "delete" him from the server so that he can join again and is handled as a new user, with all the starting-stuff. Is there any lua-command or file I can delete to 'delete the user from the server' ?

best regards,
doppelEben

Jap2.0
Smart Inserter
Smart Inserter
Posts: 2339
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Delete a player from the Server

Post by Jap2.0 »

Can you upload a save for me to poke around in?
There are 10 types of people: those who get this joke and those who don't.

doppelEben
Fast Inserter
Fast Inserter
Posts: 117
Joined: Thu Oct 27, 2016 6:21 am
Contact:

Re: Delete a player from the Server

Post by doppelEben »


Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Delete a player from the Server

Post by Nexela »

Code: Select all

/c game.remove_offline_players(game.players["Padde"].index)
or (this should work and keep all other earned stats)

Code: Select all

/c game.raise_event(defines.event.on_player_created, {player_index = game.players["Padde"].index})
Because of mods both of these "could" have bad behaviours depending on what other mods do re on_player_created

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Delete a player from the Server

Post by eradicator »

What i've used before in a similar situation is:

Code: Select all

/c game.players['Padde'].get_inventory(defines.inventory.player_armor)[1].set_stack(game.player.get_inventory(defines.inventory.player_armor)[1])
This will place an exact copy of the armor of the person typing the command into 'Padde's armor slot. The armor currently in his slot will be destroyed, so tell him to take it out if it's important.

Here's a more generic version that will copy the cursor item to other players in case you need to retrieve other stuff.

Code: Select all

/c
local player1='YourName'
local player2='TheirName'
game.players[player1].cursor_stack.set_stack(game.players[player2].cursor_stack)

Zavian
Smart Inserter
Smart Inserter
Posts: 1641
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: Delete a player from the Server

Post by Zavian »

A simpler solution might be to find a friend who isn't going to play. Have them join, dump their new armour in a box, and then leave. (This isn't very scalable but it avoids the need for console commands). If you can probably fake that by turning off authentication in the server setup, and having an existing player temporarily change his in his factorio name in settings. (The host could probably also do that by changing his name, and loading the map in single player between sessions).

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Delete a player from the Server

Post by darkfrei »

You can also add the same code to the on_player_respawned like in on_player_created.

doppelEben
Fast Inserter
Fast Inserter
Posts: 117
Joined: Thu Oct 27, 2016 6:21 am
Contact:

Re: Delete a player from the Server

Post by doppelEben »

Nexela wrote:

Code: Select all

/c game.remove_offline_players(game.players["Padde"].index)
or (this should work and keep all other earned stats)

Code: Select all

/c game.raise_event(defines.event.on_player_created, {player_index = game.players["Padde"].index})
Because of mods both of these "could" have bad behaviours depending on what other mods do re on_player_created
eradicator wrote:What i've used before in a similar situation is:

Code: Select all

/c game.players['Padde'].get_inventory(defines.inventory.player_armor)[1].set_stack(game.player.get_inventory(defines.inventory.player_armor)[1])
This will place an exact copy of the armor of the person typing the command into 'Padde's armor slot. The armor currently in his slot will be destroyed, so tell him to take it out if it's important.

Here's a more generic version that will copy the cursor item to other players in case you need to retrieve other stuff.

Code: Select all

/c
local player1='YourName'
local player2='TheirName'
game.players[player1].cursor_stack.set_stack(game.players[player2].cursor_stack)
thanks for the tipps guys. will write that down if another time the armor says bye :)
Zavian wrote:A simpler solution might be to find a friend who isn't going to play. Have them join, dump their new armour in a box, and then leave. (This isn't very scalable but it avoids the need for console commands). If you can probably fake that by turning off authentication in the server setup, and having an existing player temporarily change his in his factorio name in settings. (The host could probably also do that by changing his name, and loading the map in single player between sessions).
Thats what we did in the end. The new user dropped his starting-equip in a chest and "padde" could grab it from there.

Post Reply

Return to “Technical Help”