Jump to content
  • 0

Make a key for Unlocked vehicles


LePogo

Question

Hi! I am trying to make it possible for players to use some items (KeyMasterKit + Whaterver) to create a key while looking at an unlocked car. (even cars that were spawned on the map randomly)

I know this script exist somewhere because I saw it on a server.

 

This script would require to change the vehicle ''_activatingplayer'' and associate a key with the new car with this I suppose :

 

// First select key color


_keyColor = ["Green","Red","Blue","Yellow","Black"] call BIS_fnc_selectRandom;

// then select number from 1 - 2500
_keyNumber = (floor(random 2500)) + 1;

// Combine to key (eg.ItemKeyYellow2494) classname
_keySelected = format[("ItemKey%1%2"),_keyColor,_keyNumber];

_isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected);

_config = _keySelected;
_isOk = [player,_config] call BIS_fnc_invAdd;

waitUntil {!isNil "_isOk"};

if (_isOk and _isKeyOK) then {

 

And then attatch the new key to the players toolbelt.

 

I tried an admin script to create a key from a locked vehicle but it doesnt generate a key for a car that was spawned randomly on the map.

 

I need help selecting the vehicle ID and creating a specific key for it. that I can then add to the player's toolbelt.

 

Thanks!

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

As far as I am aware those vehicles has no characterID (ID is 0), thats why key can not be created. If you create ID, think you should be able to make a key for them, too.

Someone correct me if wrong.

   	_object setVariable ["ObjectID", "1", true];
   	_object setVariable ["ObjectUID", "1", true];
Link to comment
Share on other sites

  • 0

Thanks to both of you! I saw this script Gr8Boi but I didnt realized that there was the option to claim witch is exactly what I am looking for! I am gonna try this out and let you know if this works! I also wanted the ability to swap all keys in only one so this script is perfect! Thanks

Link to comment
Share on other sites

  • 0

Thanks to both of you! I saw this script Gr8Boi but I didnt realized that there was the option to claim witch is exactly what I am looking for! I am gonna try this out and let you know if this works! I also wanted the ability to swap all keys in only one so this script is perfect! Thanks

 

I tried to install this script, but the claim part didnt work for me :(

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...