echoHU Posted October 19, 2018 Share Posted October 19, 2018 Hello! I am just getting into scripting in RageMP, and I have a few questions. When someone connects to the server I want to force him to not spawn, instead of spawning he gets a login panel and he can’t do anything except typing in the login panel. I made a simple login panel, which can show up in game and spend informations to the server. After the login it closes. So the question is how to disable spawning on connect or make disappear the character from anyone playing on the server and the user can’t move etc.. I am coding in C#. Link to comment Share on other sites More sharing options...
Airwarfare Posted October 19, 2018 Share Posted October 19, 2018 (edited) I don't know of a way to stop the character from spawning (Maybe someone else does and can post a different solution) but the way I would do this is Stop default spawning by using this line of code (server.cs) NAPI.Server.SetAutoSpawnOnConnect(false); Then you need to listen for a player connecting so that we can make the player invisible and invincible (To prevent a death you might not expect) (server.cs) [ServerEvent(Event.PlayerConnected)] public void OnPlayerConnected(Client player) { NAPI.Entity.SetEntityTransparency(player, 0); NAPI.Entity.SetEntityInvincible(player, true); } Then you can freeze the player on the client with the following line (client.js) mp.players.local.freezePosition(true); This isn't required but recommend, you can change where these players will spawn in with the following line, that way you can place them a bit out of the way even though no one will see them and they can't die, also if you do this you will need to enable auto spawning again unless you plan on moving the players yourself (server.cs) NAPI.Server.SetDefaultSpawnLocation(new Vector3(x,y,z), 0); Keep in mind x,y,z is the position that you want them to be at so just go in game pick the spot you like get the cords and plug them in. That should be it hopefully this helps! Edited October 19, 2018 by Airwarfare Fix a few spelling mistakes and typo's 2 Link to comment Share on other sites More sharing options...
echoHU Posted October 21, 2018 Author Share Posted October 21, 2018 On 10/19/2018 at 3:38 PM, Airwarfare said: I don't know of a way to stop the character from spawning (Maybe someone else does and can post a different solution) but the way I would do this is Stop default spawning by using this line of code (server.cs) NAPI.Server.SetAutoSpawnOnConnect(false); Then you need to listen for a player connecting so that we can make the player invisible and invincible (To prevent a death you might not expect) (server.cs) [ServerEvent(Event.PlayerConnected)] public void OnPlayerConnected(Client player) { NAPI.Entity.SetEntityTransparency(player, 0); NAPI.Entity.SetEntityInvincible(player, true); } Then you can freeze the player on the client with the following line (client.js) mp.players.local.freezePosition(true); This isn't required but recommend, you can change where these players will spawn in with the following line, that way you can place them a bit out of the way even though no one will see them and they can't die, also if you do this you will need to enable auto spawning again unless you plan on moving the players yourself (server.cs) NAPI.Server.SetDefaultSpawnLocation(new Vector3(x,y,z), 0); Keep in mind x,y,z is the position that you want them to be at so just go in game pick the spot you like get the cords and plug them in. That should be it hopefully this helps! Thank you for your answer, your method is working fine. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now