h0rs 10 Posted April 25, 2014 Hey everyone, This was a post intended for the A3 section but it appears I cannot post there for some reason. I was looking for a way to lock the server while a mission is in play WITHOUT doing it via manual admin commands. I came across (http://forums.bistudio.com/showthread.php?114773-How-to-prevent-JIP) in my search, however nothing of any real use to me was present. I was thinking of something in init.sqf, like this: if (isServer) then { serverCommand "#lock"; }; However this doesn't work as the command requires being logged in and I do not believe that can be done in a non-dedicated environment anyway. As I am running this in a non-dedicated environment, and I would like a solution that would prevent players from joining the lobby (if possible). I know how to code a solution that blacks out a JIP client but that is not very ideal for my game type. Thanks! Share this post Link to post Share on other sites
IT07 10 Posted April 25, 2014 I do not think you can send commands over sqf but what you can try is a publicVariable set when someone joins the mission. For example: // file: init.sqf if (isNul "disallowedToJoin") then { hint"put player into game"; } else { hint"you are not allowed ingame"; player setDamage 1; }; The only problem is that the first player that joins will execute the code which means that there will only be one player in the mission xD You can fixed that by assigning an isServer check to the code I posted above. That will make only the server/host execute the script. Then, put a sleep at the start of disallowJoin.sqf which will be the time people are allowed to join after the host got into the game. After the sleep command you should send the disallowedToJoin PVB (publicVariable) so that all players that join after the server/host sent the PVB will be killed or whatever you want to do with them. I hope this helped. Share this post Link to post Share on other sites
h0rs 10 Posted April 26, 2014 Hey IT07, thanks for your reply! I was hoping to avoid a solution like that, as this exists (https://community.bistudio.com/wiki/serverCommand), has no one had experience or a need to use this? Share this post Link to post Share on other sites
IT07 10 Posted April 26, 2014 Oh seems like I haven't seen the whole Wiki yet xD I guess from looking at the page you linked that you can execute a serverCommand using the isServer check or isDedicated check. Here is an example: if isServer { serverCommand "#lock"; }; The c0de above will lock the server but do not run this code in the init.sqf because then it will instantly lock the server after it processes the init. Maybe you should put some sort of check on it depending on what you want to achieve. Good luck! Share this post Link to post Share on other sites
h0rs 10 Posted April 27, 2014 (edited) I have put the following code in a script which is executed by a player entering an areatrigger. // Lock the server. if (isServer) then { hint "We are the server."; _canLock = serverCommandAvailable "#lock"; if(_canLock) then { hint "We can lock."; serverCommand "#lock"; }; }; I get the hint "We can lock.", but the lock isn't actually achieved if someone is viewing the server from the server list (even after waiting and refreshing over an interval of time.) Edited April 27, 2014 by h0rs code tags Share this post Link to post Share on other sites
IT07 10 Posted April 27, 2014 Have you tried to get someone to join the server after the lock should have been applied? Share this post Link to post Share on other sites
h0rs 10 Posted April 27, 2014 Yeah I have. They are able to join. Share this post Link to post Share on other sites
IT07 10 Posted April 27, 2014 I read this on the bottom of the serverCommand wiki page: "disabled in version 1.59"...... is the server running that version? Share this post Link to post Share on other sites
h0rs 10 Posted April 27, 2014 I mentioned in my first post that this was for A3, so sorry for the confusion! I did not have permission to post there, so I posted it here. Could a mod please move this? Share this post Link to post Share on other sites
IT07 10 Posted April 27, 2014 you know what you should try? Login with the admin password yourself and then sending the #lock command to see if it works. If not, then it must be the type of the server preventing it from working. Share this post Link to post Share on other sites
h0rs 10 Posted April 27, 2014 The problem is I don't really know how to set that parameter for a listen server. In dedicated you simply set it in the profile. If I was to distribute this mission, the password (if there was one) would be different for every person who hosts it. Share this post Link to post Share on other sites
SavageCDN 231 Posted April 28, 2014 There is no way to do this on a listen server as far as I know.. .login and other admin features only work on dedicated. Share this post Link to post Share on other sites
h0rs 10 Posted April 29, 2014 There is no way to do this on a listen server as far as I know.. .login and other admin features only work on dedicated. I was afraid this might be the case :( Share this post Link to post Share on other sites
SavageCDN 231 Posted April 29, 2014 You can run a dedicated and a client on the same PC however... so that might be an option Share this post Link to post Share on other sites
h0rs 10 Posted May 2, 2014 You can run a dedicated and a client on the same PC however... so that might be an option Thanks! Looks like I'll be looking at ensuring my mission runs seamlessly under a dedicated environment then :) Share this post Link to post Share on other sites
IT07 10 Posted May 2, 2014 Just use this in the start of the init.sqf: if (isDedicated) then { } else { exitWith{} }; Share this post Link to post Share on other sites