Webby 1 Posted August 25, 2012 I would like it to automatically kick people who join a certain slot e.g Independent. But it wont kick them if they join civilian. Could someone post me link to the script or paste it in thank you. Share this post Link to post Share on other sites
Double Doppler 10 Posted August 25, 2012 (edited) You could run a check for the players side, then use forceEnd or endMission to rush them back to the lobby or use disableUserInput to force them to restart the game (the latter would require a warning hint if you want to be fair). forceEnd/endMission approach: array_badSides = ["GUER"]; // Add the sides you don't want the player to join in this array If ((side player) in array_badSides) then { forceEnd; }; disableUserInput approach: array_badSides = ["GUER"]; // Add the sides you don't want the player to join in this array If ((side player) in array_badSides) then { // 5 second countdown until player gets frozen for "_i" from 0 to 5 do { hint format["This slot is RESERVED - leave it within %1 before your input gets frozen.",(6 -_i)]; sleep 1; }; disableUserInput true; }; SeverCommand functions have been disabled in OA since v1.59 so you cannot kick players using scripts only BE admin. So you can choose either disableUserInput with a warning or force end game (which returns them back to the lobby as far as I know). Edited August 27, 2012 by Double Doppler Share this post Link to post Share on other sites
Webby 1 Posted August 25, 2012 Thank you that will be very useful ---------- Post added at 22:38 ---------- Previous post was at 22:31 ---------- Would I put this script in my mission file Share this post Link to post Share on other sites
Double Doppler 10 Posted August 25, 2012 Which mission file are you talking about? You create an init.sqf in your mission folder then use it to execute other scripts, if you are using that mission for MP you will need to consider locality of where the script is run. Your best bet for this one would be the client. Share this post Link to post Share on other sites
Webby 1 Posted August 26, 2012 I have a unit script which is a good start ---------- Post added at 12:53 ---------- Previous post was at 12:52 ---------- What I meant to say was init ---------- Post added at 12:57 ---------- Previous post was at 12:53 ---------- I have a init file in my mission folder and my mission folder is in mpmissions Share this post Link to post Share on other sites
Webby 1 Posted August 26, 2012 This is my File screenshot Share this post Link to post Share on other sites
Double Doppler 10 Posted August 27, 2012 (edited) You are using a "Life Mission" format? This should work (untested): [] spawn { if(isServer)exitWith{}; // Prevents server from running the code array_badSides = ["GUER"]; // Add the sides you don't want the player to join in this array array_whiteList = []; // Add the player IDs of the people that are allowed to join independent side here in string format. If (((side player) in array_badSides)and(!((getPlayerUID vehicle player) in array_whiteList))) then { // 20 second countdown until player gets frozen for "_i" from 0 to 20 do { hint format["This slot is RESERVED - leave it within %1 before your input gets frozen.",(21 -_i)]; sleep 1; }; disableUserInput true; }; }; Just place this at the bottom of your init.sqf file. And fill in the array_whiteList as you see fit. Edited August 27, 2012 by Double Doppler Code cleaned up Share this post Link to post Share on other sites
Webby 1 Posted August 27, 2012 still cant get it to work. Share this post Link to post Share on other sites
Double Doppler 10 Posted August 27, 2012 Have you got -showscripterrors in your command line for the exe? I edited the code a bit, try now (make sure you place it at the bottom of the init file). Share this post Link to post Share on other sites
cuel 25 Posted August 27, 2012 Define "doesn't work" - at all or do you only get frozen everytime? Be aware that getPlayerUID only returns something in a multiplayer session. I also don't see a reason why you would have "vehicle" in that if-statement :). Share this post Link to post Share on other sites
Webby 1 Posted August 27, 2012 realised i already have a [spwn] in my init which does differant thing which is stopping this code Share this post Link to post Share on other sites
cuel 25 Posted August 27, 2012 A what? Spawn? That spawns a new thread, that won't be a problem. If you're testing this as a listen server, it won't run. It will only run on clients, never the server. To test it you need to have someone connect to your listen server, or upload it to a dedicated server. Share this post Link to post Share on other sites
Webby 1 Posted August 27, 2012 can you join to test it ---------- Post added at 19:36 ---------- Previous post was at 19:32 ---------- already have this in my init []spawn { while{true}do { sleep 1; if(player getVariable "flashed" and isciv) then { _fadeInTime = 0; _fadeOutTime = 5; if (not(alive player)) exitWith {}; titleCut ["","WHITE OUT",0]; sleep _fadeOutTime; titleCut ["","WHITE IN",0]; sleep 1; player setVariable ["flashed",false, true]; }; }; }; Share this post Link to post Share on other sites
cuel 25 Posted August 27, 2012 Unfortunately no, I'm on my crappy laptop :) Yes that won't matter, spawn creates a new thread for your CPU and runs that code while still executing the rest of the code in init.sqf Share this post Link to post Share on other sites
Webby 1 Posted August 27, 2012 ah ok do i need to put my id in it as i can still join indpendant without puttin my id in Share this post Link to post Share on other sites
Webby 1 Posted August 27, 2012 people can still join independant ---------- Post added at 21:53 ---------- Previous post was at 21:52 ---------- when not suppose to Share this post Link to post Share on other sites
cuel 25 Posted August 27, 2012 Just noticed that the array with sides was in a string format. Uncertain if that works. Try this. [] spawn { if(isServer)exitWith{}; // Prevents server from running the code waitUntil {!isNull player}; if ((side player) == RESISTANCE) then { _whiteList = ["123456","654321"]; // Add the player IDs of the people that are allowed to join here in string format. waitUntil {(getPlayerUID player) != ""}; if (!((getPlayerUID player) in _whiteList)) then { sleep 0.1; hint "This slot is RESERVED! Rejoin in a different slot."; sleep 5; endMission "LOSER"; }; }; }; Share this post Link to post Share on other sites
Double Doppler 10 Posted August 27, 2012 (edited) You should change RESISTANCE to GUER. String format works AFAIK, I ran a test in the editor and it returned true when I was independent. Edited August 27, 2012 by Double Doppler Share this post Link to post Share on other sites
cuel 25 Posted August 27, 2012 (edited) In that case, both shold work :) http://community.bistudio.com/wiki/Side http://community.bistudio.com/wiki/CfgVehicles_Config_Reference#side Edited August 27, 2012 by cuel Share this post Link to post Share on other sites
mathiask1 1 Posted November 20, 2012 (edited) i tried that script, but when the guy that joined the slot got kicked he turned into an AI and shot the hell out of me any help`?? Fixed it :D Edited November 20, 2012 by Mathiask1 Share this post Link to post Share on other sites