ka0s

Vehicle amount restriction for player.

31 posts in this topic

Advertisement
On 10/11/2015 at 8:25 PM, SaintZ said:

I'd like to use V-Garage simply at the trader because my players are wanting me to open a server that will include jets and planes and such. Where would you park a jet? Well if you have a virtual garage at the traders intended for jets and planes players could store their aircraft at the trader. Also for some reason my players have been mentioning a problem with their helis randomly blowing up at their bases. This could and would solve that as well. So if anyone has access to a basic script for V-Garage hit me up and ill see what I can do to make it work with exile and as many configurable options that I can (still a noob scripter so don't expect too much).

hii, where can i found V-garage to put on my server, i've been looking on the forums, armaholic, and nothing xD

thx

Share this post


Link to post
Share on other sites

@ka0s have you found a solution for vehicle amount restriction ? I don't want to use Virtual Garage at this point, but somehow want to restrict players from having more then X cars.

Edited by Chernaruski

Share this post


Link to post
Share on other sites

You would need to override the ExileServer_system_trading_network_purchaseVehicleRequest.sqf file and put a condition in that does a database check on the vehicles table to get the count of all vehicles owned by the player uid.  If that count  is less than 5 then allow the purchase.  If not, send a toast message back the client stating that the max number of vehicles has been reached.

Share this post


Link to post
Share on other sites

Based on the Claim Vehicles mod you are using by Mezo, I think it would be easier to put the check server side, rather than in the client side file, so we don't have to get into creating network messages.  It gets pretty complicated and in this case, having the check server side should be secure enough.

First we need to create a query in the exile.ini file to query the database and get a count of the vehicles with the players UID.  Add these lines to that file.  It can be anywhere in the file, preferably at the end.  The file is located in @ExileServer\extDB\sql_custom_v2  - server side.

[getVehicleCount]
SQL1_1 = SELECT COUNT(account_uid) FROM vehicle WHERE account_uid = ?
Number Of Inputs = 1
SQL1_INPUTS = 1
OUTPUT = 1

Edit the ExileServer_ClaimVehicles_network_saveVehicleRequest.sqf file in Mezos mod like this.  Adds are in bold.

Spoiler

.............

if !(count _pinCode == 4) then
{
        throw "Your pincode must be 4 digits!";
};

//Mod for restricting the number of owned vehicles.  Born2Kill - Blackheartsgaming.com

_playerObject = _sessionID call ExileServer_system_session_getPlayerObject

_data = format ["getVehicleCount:%1", (getPlayerUID _playerObject)] call ExileServer_system_database_query_selectSingle;

if ((_data select 0) >= 5) then {

     throw "You are only allowed a maximum of 5 owned vehicles.";

};

// End Mod for restricting the number of owned vehicles.  Born2Kill - Blackheartsgaming.com

..............

_playerObject removeMagazineGlobal "Exile_Item_CodeLock";

 

Change 5 to whatever number you want, and alter the message as you see fit.

I tested that the database calls were working properly but I don't have the mod, nor do I know if you have altered these file so I am making a few assumptions.

Give this a go and let me know if it works.  Remember to test and re-test before putting it into production.

  • Like 1

Share this post


Link to post
Share on other sites

Thank you for you help @BlackheartsGaming , but I'm not sure how to move & use this newly created override to serverside. 

The ClaimVehicle script , I use, uses client side function - ExileClient_ClaimVehicles_network_claimRequestSend.sqf  to put a codelock on vehicles. 
You recommend using different approach with a differently named serverside ExileServer_ClaimVehicles_network_saveVehicleRequest.sqf ?
ExileServer_ClaimVehicles_network_saveVehicleRequest.sqf  nowhere to be found , so I cant rewrite / add your code .

Edited by Chernaruski

Share this post


Link to post
Share on other sites
On 3/6/2018 at 7:13 PM, BlackheartsGaming said:

Is this the mod you are using?

https://github.com/Mezo/Claim-Vehicles

Oh, ffs. Of course its on the server side ... duh. Done.
I tried everything you've suggested and nothing happens upon entering the codelock pin code.  No messages , no nothing. rpt looks legit
 

Edited by Chernaruski

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.