Theassassinzz 7 Posted February 18, 2017 Hey guys, So I am still messing around with my Area Lock script. I've gotten it to accept name tags, but I'm trying to implement player UID. I have this done but can't get it to work This is my initUtil.sqf uidListA = [ "00000000000000000"/* Assassinzz */, "00000000000000000"/* Kadaire */, "00000000000000000"/* Halvix */, "00000000000000000"/* Elikat */, "00000000000000000"/* BigSky */, "00000000000000000"/* Snakebite */, "00000000000000000"/* Grunt */, "00000000000000000"/* God Dammit */, "00000000000000000"/* RageOnJack3D */ ] tz_util_isTRC = { private ["_unit", "_name"]; _name = toArray name _this; _name resize 5; (toString _name == "{TRC}"); }; tz_util_isAdmin = { private ["_unit", "_uid1"]; _uid1 = toArray getPlayerUID player; (toString _uid1 == uidListA); }; Here is my lock script that I am trying to get to work with "tz_util_isAdmin" { if ((vehicle player) == _x && ((getPos _x) select 2 < 1) && !(player call tz_util_isTRC)) then { { // Let player know this is members area and they are being removed hintC "This is a Members only area!"; // Teleport them _x setPos (getMarkerPos "respawn_west"); } forEach (crew _x); // Teleport vehicle to spawn _x setPos (getMarkerPos "vehicle_teleport"); }; // Teleports single person if (player == _x && !(_x call tz_util_isTRC)) then { // Let player know this is members area and they are being removed hintC "This is a Members only area!"; // Teleport them _x setPos (getMarkerPos "respawn_west"); }; } forEach _this; when I plugin in the "tz_util_isAdmin" I get a variable error saying there is a string when an array expected. Any help would be greatly appreciated! Share this post Link to post Share on other sites
serena 151 Posted February 18, 2017 You can replace call _unit call tz_util_isTRC with: private _isUnitNameStartingFromTRC = (name _unit) find "{TRC}" == 0 1 Share this post Link to post Share on other sites
killzone_kid 1331 Posted February 18, 2017 53 minutes ago, Theassassinzz said: (toString _uid1 == uidListA); You comparing uid to the whole array. Not that you can never find a match, == doesn't work with arrays. Share this post Link to post Share on other sites
killzone_kid 1331 Posted February 18, 2017 54 minutes ago, Theassassinzz said: ] tz_util_isTRC = also missing ; Come on man, you cannot be serious! Share this post Link to post Share on other sites
Theassassinzz 7 Posted February 18, 2017 21 minutes ago, serena said: You can replace call _unit call tz_util_isTRC with: private _isUnitNameStartingFromTRC = (name _unit) find "{TRC}" == 0 Ah I see, the way I have it with names works just fine ':D It's using UID's where I'm having trouble. 8 minutes ago, killzone_kid said: also missing ; Come on man, you cannot be serious! Not to be rude, I do appreciate the help, but that part of the script works fine haha. It's my UID that I'm trying to find, but thank you there for the comment on the "==", I'll mess around a bit with it. Still new to the scripting but thank you for the help, you have responded to all of my 3 posts! Share this post Link to post Share on other sites
killzone_kid 1331 Posted February 18, 2017 3 minutes ago, Theassassinzz said: but that part of the script works fine haha. no it doesn't but hey, you know better of course! Share this post Link to post Share on other sites
Theassassinzz 7 Posted February 18, 2017 4 minutes ago, killzone_kid said: no it doesn't but hey, you know better of course! I see what you mean now! looked like you were saying that the whole isTRC wan't working. Stupid mistakes, well hey man, Thanks for pointing me in the right direction!! Sorry I doubted you even though you are the master scripter haha ':D Share this post Link to post Share on other sites
serena 151 Posted February 18, 2017 Code after tz_util_isAdmin can be replaced with: if ((name player) find "{TRC}" != 0) then { private _vehicle = vehicle player; if (_vehicle in _this) then { hintC "This is a Members only area!"; _vehicle setPos (getMarkerPos (["vehicle_teleport", "respawn_west"] select (_vehicle == player))); }; }; Do all same things but faster and shorter: Checks if a player from TRC squad/clan Checks if player or his vehicle in _this array Moves vehicles with crew to vehicle_teleport marker or players on feet to respawn_west marker * code not tested, can contain errors * added brackets to (_vehicle == player) 1 Share this post Link to post Share on other sites
Theassassinzz 7 Posted February 18, 2017 Just now, serena said: Function tz_util_isAdmin can be replaced with: if ((name player) find "{TRC}" != 0) then { private _vehicle = vehicle player; if (_vehicle in _this) then { hintC "This is a Members only area!"; _vehicle setPos (getMarkerPos (["vehicle_teleport", "respawn_west"] select _vehicle == player)); }; }; Do all same things but faster and shorter: Checks if a player from TRC squad/clan Checks if player or his vehicle in _this array Moves vehicles with crew to vehicle_teleport marker or players on feet to respawn_west marker * code not tested, can contain errors Thank you so much! I'll try that out ASAP! Share this post Link to post Share on other sites
serena 151 Posted February 18, 2017 * added brackets to (_vehicle == player) 1 Share this post Link to post Share on other sites
Theassassinzz 7 Posted February 18, 2017 54 minutes ago, killzone_kid said: You comparing uid to the whole array. Not that you can never find a match, == doesn't work with arrays. Thank you man!! Got it to work now! changed it to tz_util_isAdmin = { private ["_unit", "_uid1"]; _uid1 = toArray getPlayerUID player; (toString _uid1 in uidListA); }; Am semi-colon'd that line I fucked up on haha. Share this post Link to post Share on other sites
serena 151 Posted February 18, 2017 Who not just: tz_util_isAdmin = { (getPlayerUID player) in uidListA}; Or, even: private _playerIsAdmin = (getPlayerUID player) in uidListA; 1 Share this post Link to post Share on other sites
Theassassinzz 7 Posted February 18, 2017 2 minutes ago, serena said: Who not just: tz_util_isAdmin = { (getPlayerUID player) in uidListA}; Because I over complicated this shit haha. I guess I have another one to test haha. Share this post Link to post Share on other sites