Jump to content

[Release] Single Currency Axe Cop Service Points for SC


Recommended Posts

Credits to Axe for orignal script.
 
Universal for 1.1 and 2.0

  
These are based on my dev functions: (The functions are needed in your compiles, double check this!)
 

 

THE DEV FUNCTIONS are needed!
 
 
 
 
You can find Service Points files on github here:
 
Replace your old files with these.
 
https://github.com/EpochSC/ServicePointSC

 

Change the configs to your likings.

Link to comment
Share on other sites

Thanks, been waiting for this. :)

 

I'm getting some errors in my client rpt log

if !([ player,_costs select 1] call SC_fnc_removeCoins) then >


  Error position: <select 1] call SC_fnc_removeCoins) then >
  Error Zero divisor
File mpmissions\__CUR_MP.panthera2\custom\service_point\service_point_refuel.sqf, line 15
Error in expression <;


if !([ player,_costs select 1] call SC_fnc_removeCoins) then {
_textMissing >
  Error position: <SC_fnc_removeCoins) then {
_textMissing >
  Error Undefined variable in expression: sc_fnc_removecoins
File mpmissions\__CUR_MP.panthera2\custom\service_point\service_point_repair.sqf, line 14
Error in expression <;


if !([ player,_costs select 1] call SC_fnc_removeCoins) then {
_textMissing >
  Error position: <SC_fnc_removeCoins) then {
_textMissing >
  Error Undefined variable in expression: sc_fnc_removecoins
File mpmissions\__CUR_MP.panthera2\custom\service_point\service_point_rearm.sqf, line 15
Error in expression <;

 

anyone figure this out yet?

 

Oh and just to let everyone know there is a missing ] in service_point.sqf

This

_repair_costs = [
    ["Air",[CurrencyName,_coinsRepairAir], // 5 Gold for helicopters and planes
    ["AllVehicles",[CurrencyName,_coinsRepairVehicles]] // 2 Gold for all other vehicles
];

should be this

_repair_costs = [
    ["Air",[CurrencyName,_coinsRepairAir]], // 5 Gold for helicopters and planes
    ["AllVehicles",[CurrencyName,_coinsRepairVehicles]] // 2 Gold for all other vehicles
];

Link to comment
Share on other sites

Thanks, been waiting for this. :)

 

I'm getting some errors in my client rpt log

if !([ player,_costs select 1] call SC_fnc_removeCoins) then >

  Error position: <select 1] call SC_fnc_removeCoins) then >

  Error Zero divisor

File mpmissions\__CUR_MP.panthera2\custom\service_point\service_point_refuel.sqf, line 15

Error in expression <;

if !([ player,_costs select 1] call SC_fnc_removeCoins) then {

_textMissing >

  Error position: <SC_fnc_removeCoins) then {

_textMissing >

  Error Undefined variable in expression: sc_fnc_removecoins

File mpmissions\__CUR_MP.panthera2\custom\service_point\service_point_repair.sqf, line 14

Error in expression <;

if !([ player,_costs select 1] call SC_fnc_removeCoins) then {

_textMissing >

  Error position: <SC_fnc_removeCoins) then {

_textMissing >

  Error Undefined variable in expression: sc_fnc_removecoins

File mpmissions\__CUR_MP.panthera2\custom\service_point\service_point_rearm.sqf, line 15

Error in expression <;

 

anyone figure this out yet?

 

Oh and just to let everyone know there is a missing ] in service_point.sqf

This

_repair_costs = [

    ["Air",[CurrencyName,_coinsRepairAir], // 5 Gold for helicopters and planes

    ["AllVehicles",[CurrencyName,_coinsRepairVehicles]] // 2 Gold for all other vehicles

];

should be this

_repair_costs = [

    ["Air",[CurrencyName,_coinsRepairAir]], // 5 Gold for helicopters and planes

    ["AllVehicles",[CurrencyName,_coinsRepairVehicles]] // 2 Gold for all other vehicles

];

Got this figured out, but I'm having some trouble with the refuel, it says missing <null> more of <null> after clicking on refuel. Anyone have a solution for this?

Link to comment
Share on other sites

Thanks, been waiting for this. :)

 

I'm getting some errors in my client rpt log


  Error position: <select 1] call SC_fnc_removeCoins) then >
  Error Zero divisor
File mpmissions\__CUR_MP.panthera2\custom\service_point\service_point_refuel.sqf, line 15
Error in expression <;


if !([ player,_costs select 1] call SC_fnc_removeCoins) then {
_textMissing >
  Error position: <SC_fnc_removeCoins) then {
_textMissing >
  Error Undefined variable in expression: sc_fnc_removecoins
File mpmissions\__CUR_MP.panthera2\custom\service_point\service_point_repair.sqf, line 14
Error in expression <;


if !([ player,_costs select 1] call SC_fnc_removeCoins) then {
_textMissing >
  Error position: <SC_fnc_removeCoins) then {
_textMissing >
  Error Undefined variable in expression: sc_fnc_removecoins
File mpmissions\__CUR_MP.panthera2\custom\service_point\service_point_rearm.sqf, line 15
Error in expression <;

if !([ player,_costs select 1] call SC_fnc_removeCoins) then >

 

anyone figure this out yet?

 

Oh and just to let everyone know there is a missing ] in service_point.sqf

This

_repair_costs = [
    ["Air",[CurrencyName,_coinsRepairAir], // 5 Gold for helicopters and planes
    ["AllVehicles",[CurrencyName,_coinsRepairVehicles]] // 2 Gold for all other vehicles
];

should be this

_repair_costs = [
    ["Air",[CurrencyName,_coinsRepairAir]], // 5 Gold for helicopters and planes
    ["AllVehicles",[CurrencyName,_coinsRepairVehicles]] // 2 Gold for all other vehicles
];

 

Did you add the variables to your custom compiles? 

 

If you have Souls custom Hive.dll

In those variables change 'headShots' to 'cashMoney'

 

Refuel wasn't working as i was getting null something null (cant remember exactly)  :rolleyes:

In Service_point.sqf i changed

 

_refuel_costs = [];

 

to

 

_refuel_costs = [
["AllVehicles",[CurrencyName,_coinsRefuelVehicles]],

 

["Air",[CurrencyName,_coinsRefuelAir]]];

 

Then added:

 

_coinsRefuelVehicles = 0;

_coinsRefuelAir = 0;

 

Under:

 

_coinsRepairVehicles = 2000;

 

Probably not the best way to go about it, works tho.  :lol:

 

service_point.sqf

Link to comment
Share on other sites

 

Did you add the variables to your custom compiles? 

 

If you have Souls custom Hive.dll

In those variables change 'headShots' to 'cashMoney'

 

Refuel wasn't working as i was getting null something null (cant remember exactly)  :rolleyes:

In Service_point.sqf i changed

 

_refuel_costs = [];

 

to

 

_refuel_costs = [
["AllVehicles",[CurrencyName,_coinsRefuelVehicles]],

 

["Air",[CurrencyName,_coinsRefuelAir]]];

 

Then added:

 

_coinsRefuelVehicles = 0;

_coinsRefuelAir = 0;

 

Under:

 

_coinsRepairVehicles = 2000;

 

Probably not the best way to go about it, works tho.  :lol:

 

service_point.sqf

Thanks, I'll try this later today.

I

No I don't use Soul's .dll cause no one there seems willing the try and help me get it working, I have nothing but errors with his .dll file. I wish I could get his to work cause I would rather use this version instead of the original.

Link to comment
Share on other sites

Specifically what stations?

As you know service stations normally have the yellow colored text "VEHICLE SERVICE POINT NEARBY" come up automatically when you're in close range (10 meters or so) and they have the service point mousewheel menu appear as per normal.  The one which was "not working" for us: (North of Solnichniy) didn't had the text and no mouse wheel service point options came up.

 

I am 100% sure it did NOT work when we tested it last time (just before I posted this thread). We had 5 guys in the heli, we took turns trying to figure out what's wrong with it and it consistently did not work.

We were lifting a heli and the lifting heli or the lifted heli (and also none of the quickly spawned land/air vehicles received the service point action menu).

I am not sure whether a one off oddity or something else that will bug us in the future but for now we can assume it is all good as the issue affected only me and just once.

 

NO ISSUES (working consistently with over 20 restarts so far): East of Kamenka, West of Cherno, West of Elektro, East of Novy Sobor.

Link to comment
Share on other sites

Works perfectly on Overpoch Taviana with Soul's hive.dll. Thanks a lot.

 

Works very well! Once again really good work Zupa!

 

One problem I did find tho is when running Overpoch it would not refuel any of the 350Z's or Holdens?

 

Works fine for me. Just tried repairing/refueling some 350z's.

 

 

Edit// Just noticed a minor error in this.

When you don't have the right amount of money you will get a weird message something like: "You need 1000 more of Coins". Instead of calculating the amount of coins you're missing. Not exactly the most vital error but if you're a perfectionst then this fix will help:

 

service_point_repair.sqf

Find:

cutText [format[(localize "STR_EPOCH_ACTIONS_12"), _costs select 1, _textMissing], "PLAIN DOWN"];

Replace with:

_player_money = player getVariable ["cashMoney",0];
_repair_cost = _costs select 1;
_needed = _repair_cost - _player_money;
cutText [format["You need another %1 %2",_needed,CurrencyName] , "PLAIN DOWN"];

Do the same with service_point_refuel.sqf and service_point_rearm.sqf.

 

Now you get something like: You need another 500 Coins.

Link to comment
Share on other sites

I've done everything listed here, and I get no errors, but when I go to any of the fuel stations I don't get the scroll menu.

 

I'm running on Chernarus overpoch.

I've done everything as stated by Rocu and Kat as far as edits and fixes go, and I've double checked everything.

I've also added in the dev functions.

Link to comment
Share on other sites

I am using a modified version of this but i am am having issues with refuel.

I have the refuel set at free.  but when I try and refuel without any coins it tells me that i need 0 coins.

Can anyone give me some pointers?

 

// Vehicle Service Point by Axe Cop

private ["_folder","_servicePointClasses","_maxDistance","_actionTitleFormat","_actionCostsFormat","_costsFree","_message","_messageShown","_refuel_enable","_refuel_costs","_refuel_updateInterval","_refuel_amount","_repair_enable","_repair_costs","_repair_repairTime","_rearm_enable","_rearm_costs","_rearm_magazineCount","_lastVehicle","_lastRole","_fnc_removeActions","_fnc_getCosts","_fnc_actionTitle","_fnc_isArmed","_fnc_getWeapons","_fnc_getMagazines"];

// ---------------- CONFIG START ----------------

// -- Single Currency Prices -- //
_coinsRepairAir = 5000;
_coinsRepairVehicles = 2000;
_coinsRepairTank = 20000;
_coinsRefuelVehicles = 0;
_coinsRefuelAir = 0;

//Rearm
_coinsRearmAir = 20000;
_coinsRearmVehicles = 10000;
_coinsRearmTank = 100000;
// -- End Single Currency Prices -- //


// general settings
_folder = "Custom\service_point\"; // folder where the service point scripts are saved, relative to the mission file
_servicePointClasses = dayz_fuelpumparray; // service point classes (can be house, vehicle and unit classes)
_maxDistance = 30; // maximum distance from a service point for the options to be shown
_actionTitleFormat = "%1 (%2)"; // text of the vehicle menu, %1 = action name (Refuel, Repair, Rearm), %2 = costs (see format below)
_actionCostsFormat = "%2 %1"; // %1 = item name, %2 = item count
_costsFree = "free"; // text for no costs
_message = "Vehicle Service Point nearby"; // message to be shown when in range of a service point (set to "" to disable)

// refuel settings
_refuel_enable = true; // enable or disable the refuel option
_refuel_costs = [
["AllVehicles",[CurrencyName,_coinsRefuelVehicles]],
["Air",[CurrencyName,_coinsRefuelAir]]
];

_refuel_updateInterval = 1; // update interval (in seconds)
_refuel_amount = 0.05; // amount of fuel to add with every update (in percent)

// repair settings
_repair_enable = true; // enable or disable the repair option
_repair_costs = [
["Air",[CurrencyName,_coinsRepairAir]], // [1,"ItemGoldBar10oz",1]
["Tank",[CurrencyName,_coinsRepairTank]], //
["AllVehicles",[CurrencyName,_coinsRepairVehicles]] // 2 Gold for all other vehicles
];
_repair_repairTime = 2; // time needed to repair each damaged part (in seconds)

// rearm settings
_rearm_enable = true; // enable or disable the rearm option
//_blockedWeaponNames=["S-5","Hydra","CRV7"]; // weapon names you wish to exclude from rearming. Leave empty [] to allow all
_blockedWeaponNames=[]; // Weapon names you wish to exclude from rearming. Leave empty [] to allow all
_blockedAmmoNames = [];

_rearm_costs = [
["Car",[CurrencyName,_coinsRearmVehicles]],
["Air",[CurrencyName,_coinsRearmAir]], //
["Tank",[CurrencyName,_coinsRearmTank]], //
["AllVehicles",[CurrencyName,_coinsRearmVehicles]] // 1 10oz Gold for all other vehicles
];
_rearm_magazineCount = 1; // amount of magazines to be added to the vehicle weapon
// ----------------- CONFIG END -----------------

call compile preprocessFileLineNumbers (_folder + "ac_functions.sqf");

_lastVehicle = objNull;
_lastRole = [];

SP_refuel_action = -1;
SP_repair_action = -1;
SP_rearm_actions = [];

_messageShown = false;

_fnc_removeActions = {
if (isNull _lastVehicle) exitWith {};
_lastVehicle removeAction SP_refuel_action;
SP_refuel_action = -1;
_lastVehicle removeAction SP_repair_action;
SP_repair_action = -1;
{
_lastVehicle removeAction _x;
} forEach SP_rearm_actions;
SP_rearm_actions = [];
_lastVehicle = objNull;
_lastRole = [];
};

_fnc_getCosts = {
private ["_vehicle","_costs","_cost"];
_vehicle = _this select 0;
_costs = _this select 1;
_cost = [];
{
private "_typeName";
_typeName = _x select 0;
if (_vehicle isKindOf _typeName) exitWith {
_cost = _x select 1;
};
} forEach _costs;
_cost
};

_fnc_actionTitle = {
private ["_actionName","_costs","_costsText","_actionTitle"];
_actionName = _this select 0;
_costs = _this select 1;
_costsText = _costsFree;
if (count _costs == 2) then {
private ["_itemName","_itemCount","_displayName"];
_itemName = _costs select 0;
_itemCount = _costs select 1;
_displayName = _itemName;
_costsText = format [_actionCostsFormat, _displayName, _itemCount];
};
_actionTitle = format [_actionTitleFormat, _actionName, _costsText];
_actionTitle
};

_fnc_isArmed = {
private ["_role","_armed"];
_role = _this;
_armed = count _role > 1;
_armed
};

_fnc_getWeapons = {
private ["_vehicle","_role","_weapons","_magazineNumber","_badAmmo","_badWeapon","_magazines","_weapon"];
_vehicle = _this select 0;
_role = _this select 1;
_weapons = [];
if (count _role > 1) then {
private ["_turret","_weaponsTurret"];
_turret = _role select 1;
_weaponsTurret = _vehicle weaponsTurret _turret;
{
private "_weaponName";
_weaponName = getText (configFile >> "CfgWeapons" >> _x >> "displayName");
//_weapons set [count _weapons, [_x, _weaponName, _turret]];

// block ammo types
_badWeapon = _weaponName in _blockedWeaponNames;
if (!_badWeapon) then {

_weapon = _x;
// get all ammo types for this weapon
_magazines = [_weapon] call _fnc_getMagazines;

// loop through all ammo types and add them to our list
{
_badAmmo = _x in _blockedAmmoNames;
// check to see if our ammo is prohibited
if (!_badAmmo) then {
// add one entry to weapons per ammo type.
_weapons set [count _weapons, [_weapon, _weaponName, _turret, _x]];
};

} foreach _magazines;
};

} forEach _weaponsTurret;
} else {
private ["_turret","_weaponsTurret","_badAmmo","_badWeapon","_magazines","_weapon"];
_turret = [-1];
_weaponsTurret = vehicle player weaponsTurret [-1];
{
private "_weaponName";
_weaponName = getText (configFile >> "CfgWeapons" >> _x >> "displayName");

// block ammo types
_badWeapon = _weaponName in _blockedWeaponNames;
if (!_badWeapon) then {

_weapon = _x;
// get all ammo types for this weapon
_magazines = [_weapon] call _fnc_getMagazines;

// loop through all ammo types and add them to our list
{
// check to see if our ammo is prohibited
_badAmmo = _x in _blockedAmmoNames;
if (!_badAmmo) then {
// add one entry to weapons per ammo type.
_weapons set [count _weapons, [_weapon, _weaponName, _turret, _x]];
};
} foreach _magazines;
};
} forEach _weaponsTurret;
};
_weapons
};

_fnc_getMagazines = {
private ["_weaponType","_magazines","_mags"];
_magazines = [];
_weaponType = _this select 0;
_magazines = getArray (configFile >> "CfgWeapons" >> _weaponType >> "magazines");

_magazines

//_ammo = _magazines select 0; // rearm with the first magazine
};

while {true} do {
private ["_vehicle","_inVehicle"];
_vehicle = vehicle player;
_inVehicle = _vehicle != player;
if (local _vehicle && _inVehicle) then {
private ["_pos","_servicePoints","_inRange"];
_pos = getPosATL _vehicle;
_servicePoints = (nearestObjects [_pos, _servicePointClasses, _maxDistance]) - [_vehicle];
_inRange = count _servicePoints > 0;
if (_inRange) then {
private ["_servicePoint","_role","_actionCondition","_costs","_actionTitle"];
_servicePoint = _servicePoints select 0;
_role = assignedVehicleRole player;
if (((str _role) != (str _lastRole)) || (_vehicle != _lastVehicle)) then {
// vehicle or seat changed
call _fnc_removeActions;
};
_lastVehicle = _vehicle;
_lastRole = _role;
_actionCondition = "vehicle _this == _target && local _target";
if (SP_refuel_action < 0 && _refuel_enable) then {
_costs = [_vehicle, _refuel_costs] call _fnc_getCosts;
_actionTitle = ["Refuel", _costs] call _fnc_actionTitle;
SP_refuel_action = _vehicle addAction [_actionTitle, _folder + "service_point_refuel.sqf", [_servicePoint, _costs, _refuel_updateInterval, _refuel_amount], -1, false, true, "", _actionCondition];
};
if (SP_repair_action < 0 && _repair_enable) then {
_costs = [_vehicle, _repair_costs] call _fnc_getCosts;
_actionTitle = ["Repair", _costs] call _fnc_actionTitle;
SP_repair_action = _vehicle addAction [_actionTitle, _folder + "service_point_repair.sqf", [_servicePoint, _costs, _repair_repairTime], -1, false, true, "", _actionCondition];
};
if (count SP_rearm_actions == 0 && _rearm_enable) then {
private ["_weapons"];
_costs = [_vehicle, _rearm_costs] call _fnc_getCosts;
_weapons = [_vehicle, _role] call _fnc_getWeapons;
{
private ["_weaponName","_magazineName"];
_weaponName = _x select 1;
_magazineName = _x select 3;
_actionTitle = [format["Rearm %1 - %2", _weaponName, _magazineName], _costs] call _fnc_actionTitle;
SP_rearm_action = _vehicle addAction [_actionTitle, _folder + "service_point_rearm.sqf", [_servicePoint, _costs, _rearm_magazineCount, _x], -1, false, true, "", _actionCondition];
SP_rearm_actions set [count SP_rearm_actions, SP_rearm_action];
} forEach _weapons;
};

if (!_messageShown && _message != "") then {
_messageShown = true;
_vehicle vehicleChat _message;
};
} else {
call _fnc_removeActions;
_messageShown = false;
};
} else {
call _fnc_removeActions;
_messageShown = false;
};
sleep 2;
};

 

If I have coin on me, it will refuel but not deduct any coin.

Link to comment
Share on other sites

I am using a modified version of this but i am am having issues with refuel.

I have the refuel set at free.  but when I try and refuel without any coins it tells me that i need 0 coins.

Can anyone give me some pointers?

 

// Vehicle Service Point by Axe Cop

private ["_folder","_servicePointClasses","_maxDistance","_actionTitleFormat","_actionCostsFormat","_costsFree","_message","_messageShown","_refuel_enable","_refuel_costs","_refuel_updateInterval","_refuel_amount","_repair_enable","_repair_costs","_repair_repairTime","_rearm_enable","_rearm_costs","_rearm_magazineCount","_lastVehicle","_lastRole","_fnc_removeActions","_fnc_getCosts","_fnc_actionTitle","_fnc_isArmed","_fnc_getWeapons","_fnc_getMagazines"];

// ---------------- CONFIG START ----------------

// -- Single Currency Prices -- //
_coinsRepairAir = 5000;
_coinsRepairVehicles = 2000;
_coinsRepairTank = 20000;
_coinsRefuelVehicles = 0;
_coinsRefuelAir = 0;

//Rearm
_coinsRearmAir = 20000;
_coinsRearmVehicles = 10000;
_coinsRearmTank = 100000;
// -- End Single Currency Prices -- //


// general settings
_folder = "Custom\service_point\"; // folder where the service point scripts are saved, relative to the mission file
_servicePointClasses = dayz_fuelpumparray; // service point classes (can be house, vehicle and unit classes)
_maxDistance = 30; // maximum distance from a service point for the options to be shown
_actionTitleFormat = "%1 (%2)"; // text of the vehicle menu, %1 = action name (Refuel, Repair, Rearm), %2 = costs (see format below)
_actionCostsFormat = "%2 %1"; // %1 = item name, %2 = item count
_costsFree = "free"; // text for no costs
_message = "Vehicle Service Point nearby"; // message to be shown when in range of a service point (set to "" to disable)

// refuel settings
_refuel_enable = true; // enable or disable the refuel option
_refuel_costs = [
["AllVehicles",[CurrencyName,_coinsRefuelVehicles]],
["Air",[CurrencyName,_coinsRefuelAir]]
];

_refuel_updateInterval = 1; // update interval (in seconds)
_refuel_amount = 0.05; // amount of fuel to add with every update (in percent)

// repair settings
_repair_enable = true; // enable or disable the repair option
_repair_costs = [
["Air",[CurrencyName,_coinsRepairAir]], // [1,"ItemGoldBar10oz",1]
["Tank",[CurrencyName,_coinsRepairTank]], //
["AllVehicles",[CurrencyName,_coinsRepairVehicles]] // 2 Gold for all other vehicles
];
_repair_repairTime = 2; // time needed to repair each damaged part (in seconds)

// rearm settings
_rearm_enable = true; // enable or disable the rearm option
//_blockedWeaponNames=["S-5","Hydra","CRV7"]; // weapon names you wish to exclude from rearming. Leave empty [] to allow all
_blockedWeaponNames=[]; // Weapon names you wish to exclude from rearming. Leave empty [] to allow all
_blockedAmmoNames = [];

_rearm_costs = [
["Car",[CurrencyName,_coinsRearmVehicles]],
["Air",[CurrencyName,_coinsRearmAir]], //
["Tank",[CurrencyName,_coinsRearmTank]], //
["AllVehicles",[CurrencyName,_coinsRearmVehicles]] // 1 10oz Gold for all other vehicles
];
_rearm_magazineCount = 1; // amount of magazines to be added to the vehicle weapon
// ----------------- CONFIG END -----------------

call compile preprocessFileLineNumbers (_folder + "ac_functions.sqf");

_lastVehicle = objNull;
_lastRole = [];

SP_refuel_action = -1;
SP_repair_action = -1;
SP_rearm_actions = [];

_messageShown = false;

_fnc_removeActions = {
if (isNull _lastVehicle) exitWith {};
_lastVehicle removeAction SP_refuel_action;
SP_refuel_action = -1;
_lastVehicle removeAction SP_repair_action;
SP_repair_action = -1;
{
_lastVehicle removeAction _x;
} forEach SP_rearm_actions;
SP_rearm_actions = [];
_lastVehicle = objNull;
_lastRole = [];
};

_fnc_getCosts = {
private ["_vehicle","_costs","_cost"];
_vehicle = _this select 0;
_costs = _this select 1;
_cost = [];
{
private "_typeName";
_typeName = _x select 0;
if (_vehicle isKindOf _typeName) exitWith {
_cost = _x select 1;
};
} forEach _costs;
_cost
};

_fnc_actionTitle = {
private ["_actionName","_costs","_costsText","_actionTitle"];
_actionName = _this select 0;
_costs = _this select 1;
_costsText = _costsFree;
if (count _costs == 2) then {
private ["_itemName","_itemCount","_displayName"];
_itemName = _costs select 0;
_itemCount = _costs select 1;
_displayName = _itemName;
_costsText = format [_actionCostsFormat, _displayName, _itemCount];
};
_actionTitle = format [_actionTitleFormat, _actionName, _costsText];
_actionTitle
};

_fnc_isArmed = {
private ["_role","_armed"];
_role = _this;
_armed = count _role > 1;
_armed
};

_fnc_getWeapons = {
private ["_vehicle","_role","_weapons","_magazineNumber","_badAmmo","_badWeapon","_magazines","_weapon"];
_vehicle = _this select 0;
_role = _this select 1;
_weapons = [];
if (count _role > 1) then {
private ["_turret","_weaponsTurret"];
_turret = _role select 1;
_weaponsTurret = _vehicle weaponsTurret _turret;
{
private "_weaponName";
_weaponName = getText (configFile >> "CfgWeapons" >> _x >> "displayName");
//_weapons set [count _weapons, [_x, _weaponName, _turret]];

// block ammo types
_badWeapon = _weaponName in _blockedWeaponNames;
if (!_badWeapon) then {

_weapon = _x;
// get all ammo types for this weapon
_magazines = [_weapon] call _fnc_getMagazines;

// loop through all ammo types and add them to our list
{
_badAmmo = _x in _blockedAmmoNames;
// check to see if our ammo is prohibited
if (!_badAmmo) then {
// add one entry to weapons per ammo type.
_weapons set [count _weapons, [_weapon, _weaponName, _turret, _x]];
};

} foreach _magazines;
};

} forEach _weaponsTurret;
} else {
private ["_turret","_weaponsTurret","_badAmmo","_badWeapon","_magazines","_weapon"];
_turret = [-1];
_weaponsTurret = vehicle player weaponsTurret [-1];
{
private "_weaponName";
_weaponName = getText (configFile >> "CfgWeapons" >> _x >> "displayName");

// block ammo types
_badWeapon = _weaponName in _blockedWeaponNames;
if (!_badWeapon) then {

_weapon = _x;
// get all ammo types for this weapon
_magazines = [_weapon] call _fnc_getMagazines;

// loop through all ammo types and add them to our list
{
// check to see if our ammo is prohibited
_badAmmo = _x in _blockedAmmoNames;
if (!_badAmmo) then {
// add one entry to weapons per ammo type.
_weapons set [count _weapons, [_weapon, _weaponName, _turret, _x]];
};
} foreach _magazines;
};
} forEach _weaponsTurret;
};
_weapons
};

_fnc_getMagazines = {
private ["_weaponType","_magazines","_mags"];
_magazines = [];
_weaponType = _this select 0;
_magazines = getArray (configFile >> "CfgWeapons" >> _weaponType >> "magazines");

_magazines

//_ammo = _magazines select 0; // rearm with the first magazine
};

while {true} do {
private ["_vehicle","_inVehicle"];
_vehicle = vehicle player;
_inVehicle = _vehicle != player;
if (local _vehicle && _inVehicle) then {
private ["_pos","_servicePoints","_inRange"];
_pos = getPosATL _vehicle;
_servicePoints = (nearestObjects [_pos, _servicePointClasses, _maxDistance]) - [_vehicle];
_inRange = count _servicePoints > 0;
if (_inRange) then {
private ["_servicePoint","_role","_actionCondition","_costs","_actionTitle"];
_servicePoint = _servicePoints select 0;
_role = assignedVehicleRole player;
if (((str _role) != (str _lastRole)) || (_vehicle != _lastVehicle)) then {
// vehicle or seat changed
call _fnc_removeActions;
};
_lastVehicle = _vehicle;
_lastRole = _role;
_actionCondition = "vehicle _this == _target && local _target";
if (SP_refuel_action < 0 && _refuel_enable) then {
_costs = [_vehicle, _refuel_costs] call _fnc_getCosts;
_actionTitle = ["Refuel", _costs] call _fnc_actionTitle;
SP_refuel_action = _vehicle addAction [_actionTitle, _folder + "service_point_refuel.sqf", [_servicePoint, _costs, _refuel_updateInterval, _refuel_amount], -1, false, true, "", _actionCondition];
};
if (SP_repair_action < 0 && _repair_enable) then {
_costs = [_vehicle, _repair_costs] call _fnc_getCosts;
_actionTitle = ["Repair", _costs] call _fnc_actionTitle;
SP_repair_action = _vehicle addAction [_actionTitle, _folder + "service_point_repair.sqf", [_servicePoint, _costs, _repair_repairTime], -1, false, true, "", _actionCondition];
};
if (count SP_rearm_actions == 0 && _rearm_enable) then {
private ["_weapons"];
_costs = [_vehicle, _rearm_costs] call _fnc_getCosts;
_weapons = [_vehicle, _role] call _fnc_getWeapons;
{
private ["_weaponName","_magazineName"];
_weaponName = _x select 1;
_magazineName = _x select 3;
_actionTitle = [format["Rearm %1 - %2", _weaponName, _magazineName], _costs] call _fnc_actionTitle;
SP_rearm_action = _vehicle addAction [_actionTitle, _folder + "service_point_rearm.sqf", [_servicePoint, _costs, _rearm_magazineCount, _x], -1, false, true, "", _actionCondition];
SP_rearm_actions set [count SP_rearm_actions, SP_rearm_action];
} forEach _weapons;
};

if (!_messageShown && _message != "") then {
_messageShown = true;
_vehicle vehicleChat _message;
};
} else {
call _fnc_removeActions;
_messageShown = false;
};
} else {
call _fnc_removeActions;
_messageShown = false;
};
sleep 2;
};

 

If I have coin on me, it will refuel but not deduct any coin.

 

See here for fix:

Link to comment
Share on other sites

I've done everything listed here, and I get no errors, but when I go to any of the fuel stations I don't get the scroll menu.

 

I'm running on Chernarus overpoch.

I've done everything as stated by Rocu and Kat as far as edits and fixes go, and I've double checked everything.

I've also added in the dev functions.

 

Did you follow the original Service Point tutorial first? If not, do that first, THEN replace it with Zupa's files. Here's the original: 

Link to comment
Share on other sites

same here  I cant get this to work  I have had original working fine and I just replace the the files on here with the old ones and nothing, then I do the fixes stated on the first page and I get the scroll options but nothing happens when I click on them? Can someone please drop me a link the their working files for this. I don't know what else to try. Thanks 

Link to comment
Share on other sites

Struggling to get this working properly 

 

I am  no no longer getting any messages or options.

 

Could someone take a look and see what's wrong?

 

http://pastebin.com/Q4aDksT6

 

Thank you

 

did you add the functions to the top of your compiles.sqf? I use souls custom hive.dll

//Player only

BIS_fnc_numberDigits 	= compile preprocessFileLineNumbers "custom\numberDigits.sqf";
BIS_fnc_numberText 	= compile preprocessFileLineNumbers "custom\numberText.sqf"; 
// usage
// _removed = [player, 5000] call SC_fnc_removeCoins;
// if(_removed = true)then{  GREAT SUCCES  }else{ IT FAILED, not enoguh money};

SC_fnc_removeCoins=
	{
				private ["_player","_amount","_wealth","_newwealth", "_result"];
				_player =  _this select  0;
				_amount =  _this select  1;
				_result = false;
				_wealth = _player getVariable["cashMoney",0];		
				if (_wealth < _amount) then { 
					_result = false;
				} else { 						
				_newwealth = _wealth - _amount;
				_player setVariable["cashMoney",_newwealth, true];
				_player setVariable ["moneychanged",1,true];	
				_result = true;
				PVDZE_plr_Save = [_player,(magazines _player),true,true] ;
				publicVariableServer "PVDZE_plr_Save";			
				};
				_result
	};

// usage
// _added = [player, 5000] call SC_fnc_addCoins;
// if(_added = true)then{ GREAT SUCCES }else{ IT FAILED, Something went wrong};
	
SC_fnc_addCoins = 
{
	private ["_player","_amount","_wealth","_newwealth", "_result"];			
			_player =  _this select  0;
			_amount =  _this select  1;
			_result = false;	
			_wealth = _player getVariable["cashMoney",0];
			_player setVariable["cashMoney",_wealth + _amount, true];
			PVDZE_plr_Save = [_player,(magazines _player),true,true] ;
			publicVariableServer "PVDZE_plr_Save";
			_player setVariable ["moneychanged",1,true];					
			_newwealth = _player getVariable["cashMoney",0];		
			if (_newwealth >= _wealth) then { _result = true; };			
			_result
};	
Link to comment
Share on other sites

Hello, I am having trouble getting this to work correctly on our server. I cannot repair or rearm any vehicles if there is a cost for the action, but if i set the cost to 0 it works.What could be the problem?

 

Here is my service_point.sqf :


// refuel settings
_refuel_enable = true; // enable or disable the refuel option
_refuel_costs = [
["AllVehicles",[CurrencyName,_coinsRefuelVehicles]], 
["Air",[CurrencyName,_coinsRefuelAir]]]; // free for all vehicles (equal to [["AllVehicles",[]]])
_refuel_updateInterval = 1; // update interval (in seconds)
_refuel_amount = 0.05; // amount of fuel to add with every update (in percent)
 
// repair settings
_repair_enable = true; // enable or disable the repair option
_repair_costs = [
["Air",[CurrencyName,_coinsRepairAir]], // 5 Gold for helicopters and planes
["AllVehicles",[CurrencyName,_coinsRepairVehicles]]]; // 2 Gold for all other vehicles
 
_repair_repairTime = 2; // time needed to repair each damaged part (in seconds)
 
// rearm settings
_rearm_enable = true; // enable or disable the rearm option
_rearm_costs = [
["ArmoredSUV_PMC_DZE",[CurrencyName,_coinsRearmSUV]], // special costs for a single vehicle type
["Air",[CurrencyName,_coinsRearmAir]], // 2 10oz Gold for helicopters and planes
["AllVehicles",[CurrencyName,_coinsRearmVehicles]]]; // 1 10oz Gold for all other vehicles
 
_rearm_magazineCount = 3; // amount of magazines to be added to the vehicle weapon
 

 

Here is the add/remove coins code in my compiles.sqf from Zupa:

 


// usage
// _removed = [player, 5000] call SC_fnc_removeCoins;
// if(_removed = true)then{  GREAT SUCCES  }else{ IT FAILED, not enoguh money};
 
SC_fnc_removeCoins=
{
private ["_player","_amount","_wealth","_newwealth", "_result"];
_player =  _this select  0;
_amount =  _this select  1;
_result = false;
_wealth = _player getVariable["headShots",0];
if (_wealth < _amount) then { 
_result = false;
} else {
_newwealth = _wealth - _amount;
_player setVariable["headShots",_newwealth, true];
_player setVariable ["moneychanged",1,true];
_result = true;
PVDZE_plr_Save = [_player,(magazines _player),true,true] ;
publicVariableServer "PVDZE_plr_Save";
};
_result
};
 
// usage
// _added = [player, 5000] call SC_fnc_addCoins;
// if(_added = true)then{ GREAT SUCCES }else{ IT FAILED, Something went wrong};
 
SC_fnc_addCoins = 
{
private ["_player","_amount","_wealth","_newwealth", "_result"];
_player =  _this select  0;
_amount =  _this select  1;
_result = false;
_wealth = _player getVariable["headShots",0];
_player setVariable["headShots",_wealth + _amount, true];
PVDZE_plr_Save = [_player,(magazines _player),true,true] ;
publicVariableServer "PVDZE_plr_Save";
_player setVariable ["moneychanged",1,true];
_newwealth = _player getVariable["headShots",0];
if (_newwealth >= _wealth) then { _result = true; };
_result
};
 

 

Thanks for any help I get and these great scripts. 

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
×
×
  • Create New...