Mezo

[Updated] Claim Non-Persistent Vehicles

318 posts in this topic

On 4/11/2018 at 6:03 PM, Batu786 said:

A quick question, I've added some premium vehicles to my server and as they are very powerful such as AFV-4 Gorgon wheeled APC, will this mod work on this type of military vehicles, or it just works on the random spawns? 

When player buy a premium vehicle I need to provide ability to put a code lock on it so they can protect it, that's why I'm asking. 

Let's try keeping it "non premium" as the way i think you are intending that to do is by limitting access to certain "paying" players.

Share this post


Link to post
Share on other sites

It's ok, I've made changes due to Bohemia's server monetization FAQ. In fact I had no Idea that there is such thing as bohemia limits you to your server premium plans. I've applied on Bohemia's website and got approval so it's all good now. But anyway, thank you for your reply and just to clarify that this code-lock works on any vehicle, I've tested it last week. 

Share this post


Link to post
Share on other sites
Advertisement
On 09/04/2018 at 3:14 PM, kuplion said:

Most mods support this, DMS, Occupation and my modification of A3XAI.

Just came across this where can we find your modded version of this for A3XAI?

Edit:

Disregard found a link to your git

Edited by twitch.tv/smokedog77
to add edit
  • Like 1

Share this post


Link to post
Share on other sites

One of my servers is running a bunch of JohnO's Reborn scripts.  All spawned vehicles are persistent and have a specific account_uid assigned at time of spawn. In my case, I've defined the UID as "Reborn_Persistent" and there is an account with this UID as well.  Does anyone know if it would be possible to have this script allow claiming of these vehicles so that they can set the PIN and have their UID set in the db?

 

There are no non-persistent vehicles on the map, so I'm thinking that 
 

	if (_vehicle getVariable ["ExileIsPersistent", true]) then
    {
        throw "This vehicle is already claimed!";
    };

Could be replaced with a check against the owner UID and only pass it through if the UID = "Reborn_Persistent". I just don't know how to do that.

Edited by TroyT

Share this post


Link to post
Share on other sites

Ok, I figured that out with the help of StokesMagee on another topic.  If anyone needs to do something like this, this is what I did:
 

Spoiler

 


/*

 	Name: ExileServer_ClaimVehicle_network_InsertClaimedVehicle.sqf

 	Author: MezoPlays
    Copyright (c) 2016 MezoPlays

    This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
    To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0

*/
private["_sessionID","_package","_objectNetID","_pinCode","_ownerUID","_vehicle","_VehicleUID"];
_sessionID = _this select 0;
_package = _this select 1;
_objectNetID = _package select 0;
_pinCode = _package select 1;

_playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
_ownerUID = getPlayerUID _playerObject;
_vehicle = objectFromNetId _objectNetID;

_VehicleUID = _vehicle getVariable ["ExileOwnerUID", ""];

try
{
	if !(_VehicleUID == "BSF_Persistent") then  // This should be whatever account_uid you are checking for
    {
        throw "No can do...This vehicle is already claimed!";
    };

    if !(alive _playerObject) then
    {
        throw "You must be alive to claim a vehicle!";
    };
    if !(_vehicle isKindOf "AIR" || _vehicle isKindOf "CAR" || _vehicle isKindOf "TANK") then
    {
        throw "That's not a vehicle!";
    };
/* 
	if (_vehicle getVariable ["ExileIsPersistent", true]) then
    {
        throw "This vehicle is already claimed!";
    };
*/	
    if !(isNil {_vehicleObj getVariable "SC_drivenVehicle"}) then
    {
        throw "This vehicle is owned by the server!";
    };
    if !(count _pinCode == 4) then
    {
        throw "Your pincode must be 4 digits!";
    };

    _playerObject removeMagazineGlobal "Exile_Item_CodeLock";

    _vehicle setVariable ["ExileIsLocked",-1];
    _vehicle setVariable ["ExileOwnerUID", _ownerUID];
    _vehicle setVariable ["ExileAccessCode", _pinCode];
    _vehicle setVariable ["ExileIsPersistent", true];

    _vehicle lock 0;

    _vehicle call ExileServer_object_vehicle_database_insert;
    _vehicle call ExileServer_object_vehicle_database_update;


    [_sessionID, "toastRequest", ["SuccessTitleOnly", ["You're now the owner of this vehicle!"]]] call ExileServer_system_network_send_to;

}
catch
{
    [_sessionID, "toastRequest", ["ErrorTitleAndText", ["Claim Vehicles", _exception]]] call ExileServer_system_network_send_to;
    _vehicle lock 0; //Make sure the vehicle is unlocked if this stuff fails. Cheers John ;)
};

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites
On 5/20/2018 at 5:49 AM, TroyT said:

One of my servers is running a bunch of JohnO's Reborn scripts.  All spawned vehicles are persistent and have a specific account_uid assigned at time of spawn. In my case, I've defined the UID as "Reborn_Persistent" and there is an account with this UID as well.  Does anyone know if it would be possible to have this script allow claiming of these vehicles so that they can set the PIN and have their UID set in the db?

 

There are no non-persistent vehicles on the map, so I'm thinking that 
 


	if (_vehicle getVariable ["ExileIsPersistent", true]) then
    {
        throw "This vehicle is already claimed!";
    };

Could be replaced with a check against the owner UID and only pass it through if the UID = "Reborn_Persistent". I just don't know how to do that.



 Does anyone know if it would be possible to have this script allow claiming of these vehicles so that they can set the PIN , but NOT have their UID set in the db?

Share this post


Link to post
Share on other sites

Hello, the script works well with all vehicles except VEMF vehicles. (Kajman , Armed Orca, Armed Pawnee and Black Hawk) I read every page without exception and no fix works. I have the following message: this vehicle is already claimed. Even the trader nothing to do. Said to me to contact the administration. What should I do. Thx

Share this post


Link to post
Share on other sites
22 minutes ago, Sebas said:

Hello, the script works well with all vehicles except VEMF vehicles. (Kajman , Armed Orca, Armed Pawnee and Black Hawk) I read every page without exception and no fix works. I have the following message: this vehicle is already claimed. Even the trader nothing to do. Said to me to contact the administration. What should I do. Thx

You need to edit VEMF to apply the ExileIsPersistent variable to the created vehicles, and set it to false.

Share this post


Link to post
Share on other sites
3 hours ago, Sebas said:

if (_vehicle getVariable ["ExileIsPersistent", true]) then

or
_vehicle setVariable ["ExileIsPersistent", true];

Well why would you set the variable to true? In order to claim it it needs to be set to false. The second one is how i did it on a3xai vehicles but idk the context of vemf.

Share this post


Link to post
Share on other sites
Advertisement

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

  • Recently Browsing   0 members

    No registered users viewing this page.