Rearm Script

21 posts in this topic

Hi, I'm trying the Rearm script of Arma 2/3 Epoch to modify for Exile. My problem is that no money will be deducted from the account. Anyone have any idea what is wrong? Would be nice if you can help me. (This is the service_point_rearm.sqf)

// Vehicle Service Point (Rearm) by Axe Cop
// reworked for a3 epoch by Halv
private ["_sessionID","_vehicle","_args","_servicePoint","_costs","_magazineCount","_weapon","_type","_name","_weaponType","_weaponName","_turret","_magazines","_ammo","_playerObject","_money","_wallet"];
_vehicle = _this select 0;
_args = _this select 3;
_servicePoint = _args select 0;
_costs = _args select 1;
_weapon = _args select 2;
_type = typeOf _vehicle;
_name = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
_weaponName = _weapon select 0;
_ammoClass = _weapon select 1;
_ammoName = _weapon select 2;
_ammoMAX = _weapon select 3;
_ammoMIN = _weapon select 4;
_turret = _weapon select 5;

_wallet = ExileClientPlayerMoney;
_sessionID = _this select 0;
_playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
_money = _playerObject getVariable ["ExileMoney", 0];

//if (!local _vehicle) exitWith {cutText [format["%2 is not local to %1 - Re-Arm Denied!",name player, _name], "PLAIN DOWN"]; diag_log format["Error: called service_point_rearm.sqf with non-local vehicle: %1", _vehicle] };
//if(count (crew _vehicle) > 1) exitWith {cutText ["All Passengers Must Exit Vehicle - Re-Arm Denied!", "PLAIN DOWN"];};
if (_wallet < _costs) exitWith {cutText [format["You need %1 Poptab to re-arm %2",_costs,_name], "PLAIN DOWN"];};
_currentmags = magazines _vehicle;
_magscount = count _currentmags;
_ammocount = {_ammoClass == _x}count _currentmags;
if(_magscount > _ammoMAX)exitWith{cutText [format["You already have %1 magazine(s) in %2",_magscount,_weaponName], "PLAIN DOWN"];};
if(_ammocount > _ammoMIN)exitWith{cutText [format["You already have %1 magazine(s) of %2 in %3\nTotal of %4 magazine(s)",_ammocount,_ammoName,_weaponName,_magscount], "PLAIN DOWN"];};

_money = _money - _costs;
_playerObject setVariable ["ExileMoney",_money];
format["setAccountMoney:%1:%2", _money, (getPlayerUID _playerObject)] call ExileServer_system_database_query_fireAndForget;
// add a magazines
_vehicle addMagazineTurret [_ammoClass, _turret];
cutText [format["%1 of %2 Rearmed", _weaponName, _name], "PLAIN DOWN"];
//cutText [format["%1 of %2 Rearmed ---- PO %3 MONEY %4 SECCION %5", _weaponName, _name, _playerObject , _money, _sessionID], "PLAIN DOWN"];

If I let the whole show me with the last line is PO = any , MONEY = scalar NaN , SECCION = MyIngameName.


mfg Dodo

Share this post

Link to post
Share on other sites

I've got the Generic Vehicle Service (gvs) script working on my server, if you'd like a copy.

I'd be down to try it out :D

Share this post

Link to post
Share on other sites

There's the link for the The init.sqf and description.ext are just excerpts from mine that concern gvs. Find a home for that code in your existing files. In particular, you may have to copy & paste the internal class definitions in RscTitles to the one in yours. There can only be one RscTitles definition among the code for the map, so if there's other definitions of it, just merge them.

The delay for this version of gvs is set to 10 seconds to allow for multiple people using the pads one after another.

1 person likes this

Share this post

Link to post
Share on other sites

Just like the old GVS script, place hidden markers on the map "gvs_hel_0" for helicopters, "gvs_pla_0" for planes, "gvs_veh_0" for vehicles. Increment the number at the end for each marker (of each type... so you can have all three of those on the same map, but another helicopter rearm point would be "gvs_hel_1")

Helps to also place things like a helipad or parachute jumper target on the ground so people have a visual reference for where the rearm pad is.

Note that this rearm & refuel doesn't COST anything right now. If you want to add that, feel free to edit the script.

Share this post

Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.