Jump to content

[Release] Vehicle Service Point (Refuel, Repair, Rearm) [Script]


Axe Cop

Recommended Posts

I'll switch it over to a trader in stary to see if I can get that to work for now.   If that works, then it'll take some testing to see why the other npc won't work.

***

 

"UPDATE" : I got it to work by using one of the classnames from another functioning trader.  

Link to comment
Share on other sites

Help

So I have this for my service point I want to add all fuel tanks help????

_servicepoint = dayz_fuelpumparray; // service point classes (can be house, vehicle and unit classes)

In the server it's only at fuel stations I want it too be at all fuel tanks plus the fuel stations??????

Link to comment
Share on other sites

Help

So I have this for my service point I want to add all fuel tanks help????

_servicepoint = dayz_fuelpumparray; // service point classes (can be house, vehicle and unit classes)

In the server it's only at fuel stations I want it too be at all fuel tanks plus the fuel stations??????

 

Look at the the 5th post in this thread.

Link to comment
Share on other sites

what exactly did you try? depending on the map you are playing the fuel tanks are different, try this:

_servicePointClasses = dayz_fuelpumparray + dayz_fuelsources;

"dayz_fuelsources" is a global list of all fuel sources of Epoch, see variables.sqf for the full list: https://github.com/vbawol/DayZ-Epoch/blob/master/SQF/dayz_code/init/variables.sqf#L602

dayz_fuelsources = ["Land_Ind_TankSmall","Land_fuel_tank_big","Land_fuel_tank_stairs","Land_fuel_tank_stairs_ep1","Land_wagon_tanker","Land_fuelstation","Land_fuelstation_army","land_fuelstation_w","Land_benzina_schnell"];

if you want you can also add "DZE_fueltruckarray" to have mobile fuel trucks as service points. :)

Link to comment
Share on other sites

what exactly did you try? depending on the map you are playing the fuel tanks are different, try this:

_servicePointClasses = dayz_fuelpumparray + dayz_fuelsources;
"dayz_fuelsources" is a global list of all fuel sources of Epoch, see variables.sqf for the full list: https://github.com/vbawol/DayZ-Epoch/blob/master/SQF/dayz_code/init/variables.sqf#L602

dayz_fuelsources = ["Land_Ind_TankSmall","Land_fuel_tank_big","Land_fuel_tank_stairs","Land_fuel_tank_stairs_ep1","Land_wagon_tanker","Land_fuelstation","Land_fuelstation_army","land_fuelstation_w","Land_benzina_schnell"];
if you want you can also add "DZE_fueltruckarray" to have mobile fuel trucks as service points. :)

I tried this

_servicePointClasses = ["Land_A_FuelStation_Feed", "Land_A_FuelStation_Feed", "Land_Ind_TankSmall", "Land_Ind_TankSmall2", "Land_Ind_TankSmall2_EP1", "Land_fuel_tank_stairs"]; // service point classes (add "FuelPump_DZ" to use the dynamic Epoch fuel pumps)

And it didn't work

Link to comment
Share on other sites

Axe cop how can i disable a vehicle to rearm it

 

because in my server you can buy a jet without ammo

but you can rearm it on the service point :(

 

is there a way to disable for some vehicles

 

like this im not a scripter so i dont know how to do it :P

this is just a example

_blockrearm_enable = true;
_blockrearm_vehicles = [
    ["Vehicle class name here"],
    ["other vehicle class name here"]
];
Link to comment
Share on other sites

sure it is possible, I think I have posted code for that at least twice in this thread, so there is so much spam in here :D

 

so if i read it good at your post here

 

i need to do this for rearm ?

if ((_vehicle isKindOf "Vehicle class name here","Vehicle class name here" _role call _fnc_isArmed) && (count SP_rearm_actions == 0) && _rearm_enable) then {
Link to comment
Share on other sites

I've come across a couple of small issues, I've disabled auto-refueling and repair (I want people to do it the hard way :P ) but since I run a militarized server I want people to be able to rearm their military vehicles, so I set the service point as the different Reammo trucks, which works fine on land, but I've got a player who has setup base on metal panels out to sea, when the truck is out there he can't get any service point options on it, only when it's on land, I thought it was a strict distance from service point test that checks if you get the menu options or not? Because I can't see anything that would be stopping it from working.

 

The other problem I have is once you rearm AP rounds for example you can't rearm HE in a tank or other vehicle with more than one ammo type for the one gun. I've come across another rearming mod but it doesn't take money away so I can't use that, but it does give you the options to rearm each type of ammo, it looks kinda like this:

// M1A2 Abrams Tuskif (typeof vehicle player == "M1A2_TUSK_MG") then{
titleText ["REARMING PROGRESS:[|         ]COMPLETE", "PLAIN DOWN"];
sleep 1;
titleText ["REARMING PROGRESS:[||        ]COMPLETE", "PLAIN DOWN"];
sleep 1;
titleText ["REARMING PROGRESS:[|||       ]COMPLETE", "PLAIN DOWN"];
sleep 1;
titleText ["REARMING PROGRESS:[||||      ]COMPLETE", "PLAIN DOWN"];
sleep 1;
titleText ["REARMING PROGRESS:[|||||     ]COMPLETE", "PLAIN DOWN"];
sleep 1;
titleText ["REARMING PROGRESS:[||||||    ]COMPLETE", "PLAIN DOWN"];
sleep 1;
titleText ["REARMING PROGRESS:[|||||||   ]COMPLETE", "PLAIN DOWN"];
sleep 1;
titleText ["REARMING PROGRESS:[||||||||  ]COMPLETE", "PLAIN DOWN"];
sleep 1;
titleText ["REARMING PROGRESS:[||||||||| ]COMPLETE", "PLAIN DOWN"];
sleep 1;
titleText ["REARMING PROGRESS:[||||||||||]COMPLETE", "PLAIN DOWN"];
if ((position player distance _orgpos > 10) || !(gunner vehicle player == player)) then
{
titleText ["REARMING PROCESS ABORTED", "PLAIN DOWN"];
} else
{
vehicle player removemagazines "20Rnd_120mmSABOT_M1A2";
vehicle player removemagazines "20Rnd_120mmHE_M1A2";
vehicle player addmagazine "20Rnd_120mmSABOT_M1A2";
vehicle player addmagazine "20Rnd_120mmHE_M1A2";
vehicle player removemagazines "1200Rnd_762x51_M240";
vehicle player addmagazine "1200Rnd_762x51_M240";
titleText ["REARMING PROCESS COMPLETE", "PLAIN DOWN"];
};
};
vehicle player addmagazine "20Rnd_120mmSABOT_M1A2";
vehicle player addmagazine "20Rnd_120mmHE_M1A2";
 

I don't really care about the titletext crap just the ability to rearm each ammo type, is there any way to make it bring up a list of each ammo type and take money for each rather than the current system where it only seems to get the one ammo type?

 

Link to comment
Share on other sites

look at the post again mine is different, you code here will not work :D

and it only works for ONE vehicle type like that, if you want different types you need a loop or something

 

 

Ok i have found the one post for the blacklist thing its works fine

 

only 1 problem now i cant refuel or repair the vehicle any more

Link to comment
Share on other sites

Is it possible to make changes to this section AxeCop to facilitate something like I posted above? With just a test to see what kind of vehicle it is then give the options for all it's available ammo? Would there have to be some test to see what seat the player is in and only display the ammo types available to the player in that seat?

 

_fnc_getWeapons = {
private ["_vehicle","_role","_weapons"];
_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]];
} forEach _weaponsTurret;
};
_weapons
};

 

Or would it be an edit to this section of the rearm script?

 

if !([[[_costs select 0, _costs select 1]],0] call epoch_returnChange) exitWith {};


_type = typeOf _vehicle;
_name = getText(configFile >> "cfgVehicles" >> _type >> "displayName");


_weaponType = _weapon select 0;
_weaponName = _weapon select 1;
_turret = _weapon select 2;


_magazines = getArray (configFile >> "CfgWeapons" >> _weaponType >> "magazines");
_ammo = _magazines select 0; // rearm with the first magazine


// remove all magazines
//_magazines = _vehicle magazinesTurret _turret;
//{
// _vehicle removeMagazineTurret [_x, _turret];
//} forEach _magazines;


// add magazines
for "_i" from 1 to _magazineCount do {
_vehicle addMagazineTurret [_ammo, _turret];
};

titleText [format["%1 of %2 Rearmed", _weaponName, _name], "PLAIN DOWN"];

I had to comment out the remove all magazines thing or every time someone rearmed one weapon then went to rearm another one it'd strip the ammo from the first weapon rearmed.

 

 

 

https://community.bistudio.com/wiki/ArmA_2:_Weapons#Vehicle_.26_Static_Weapons I see a lot of vehicle weapons there, even just the humble PK that has a lot of ammo variations, would be really nice to have those as rearm options with varying costs depending on the ammo selected.

Link to comment
Share on other sites

That may be because the actions are private to my script only, I am not sure how that works with the antihack tools but my actions are not accessible from any other scripts so you may have problems adding it to infistar.

One solution would be to make the actions global, this is not nessesary for the script but may help you whitelisting the actions I think:

change "_refuel_action" to "s_player_refuel_action" in the script (for the other actions as well, just search and replace all) that will make them global and you should be able to add them, you have to remove them in the "private" block above,

 

change

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","_refuel_action","_repair_action","_rearm_actions","_fnc_removeActions","_fnc_getCosts","_fnc_actionTitle","_fnc_isArmed","_fnc_getWeapons"];

to

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"];

so just remove the actions ("_refuel_action","_repair_action","_rearm_actions") from that list and change the name to something without the "_" at the beginning should do it.

 

 

Btw I'm wondering how that would add a protection from a hacker, if you just use a variable name like that in your "hack" it won't protect anything I guess lol (but then again most hackers don't know what they are doing, you are lucky I don't develop hacks haha)

 

 

hi there,

 

we also use infistar on our Overpoch Napf server.

 

I also dont get the scroll  menu.

 

i removed the actions...

 

thanks

Link to comment
Share on other sites

Havoc Dirty fix I just put together, works with the BMP so I presume others. 

 

//if !([_costs] call player_checkAndRemoveItems) exitWith {};
if !([[[_costs select 0, _costs select 1]],0] call epoch_returnChange) then {
_textMissing = getText(configFile >> "CfgMagazines" >> _costs select 0 >> "displayName");
cutText [format[(localize "STR_EPOCH_ACTIONS_12"), _costs select 1, _textMissing], "PLAIN DOWN"];
} else {
 
_vehicle setVehicleAmmo 1;
 
/*
_type = typeOf _vehicle;
_name = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
 
_weaponType = _weapon select 0;
_weaponName = _weapon select 1;
_turret = _weapon select 2;
 
_magazines = getArray (configFile >> "CfgWeapons" >> _weaponType >> "magazines");
_ammo = _magazines select 0; // rearm with the first magazine
 
// remove all magazines
_magazines = _vehicle magazinesTurret _turret;
{
_vehicle removeMagazineTurret [_x, _turret];
} forEach _magazines;
 
// add magazines
for "_i" from 1 to _magazineCount do {
_vehicle addMagazineTurret [_ammo, _turret];
};
*/

 
Or for a better fix check post number 408.
Link to comment
Share on other sites

i dont get it to run!

 

i have followed all steps in this thread. yeah, 28 pages reading

 

i renamed ,"SP_refuel_action","SP_repair_action","SP_rearm_actions"

 

 

i put them in the whitelist table inside the infistar file AHconfig.sqf

 

 i added "Land_A_FuelStation_Shed", "Land_A_FuelStation_Feed"

 

i used different cars, choppers on different gas stations

 

the Scroll Menu DOES NOT APPEAR!!!

 

Any help out there?

 

We run an overpoch Napf server with infistar Antihack

 

This script driving me nuts...

Link to comment
Share on other sites

 

Havoc Dirty fix I just put together, works with the BMP so I presume others. 

 

//if !([_costs] call player_checkAndRemoveItems) exitWith {};
if !([[[_costs select 0, _costs select 1]],0] call epoch_returnChange) then {
_textMissing = getText(configFile >> "CfgMagazines" >> _costs select 0 >> "displayName");
cutText [format[(localize "STR_EPOCH_ACTIONS_12"), _costs select 1, _textMissing], "PLAIN DOWN"];
} else {
 
_vehicle setVehicleAmmo 1;
 
/*
_type = typeOf _vehicle;
_name = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
 
_weaponType = _weapon select 0;
_weaponName = _weapon select 1;
_turret = _weapon select 2;
 
_magazines = getArray (configFile >> "CfgWeapons" >> _weaponType >> "magazines");
_ammo = _magazines select 0; // rearm with the first magazine
 
// remove all magazines
_magazines = _vehicle magazinesTurret _turret;
{
_vehicle removeMagazineTurret [_x, _turret];
} forEach _magazines;
 
// add magazines
for "_i" from 1 to _magazineCount do {
_vehicle addMagazineTurret [_ammo, _turret];
};
*/

 
Or for a better fix check post number 408.

 

Oh thanks guys, I did take a look through the thread first but nothing popped out at me, awesome I'll give it a go now.

Link to comment
Share on other sites

i dont get it to run!

 

i have followed all steps in this thread. yeah, 28 pages reading

 

i renamed ,"SP_refuel_action","SP_repair_action","SP_rearm_actions"

 

 

i put them in the whitelist table inside the infistar file AHconfig.sqf

 

 i added "Land_A_FuelStation_Shed", "Land_A_FuelStation_Feed"

 

i used different cars, choppers on different gas stations

 

the Scroll Menu DOES NOT APPEAR!!!

 

Any help out there?

 

We run an overpoch Napf server with infistar Antihack

 

This script driving me nuts...

Yeah mate I run an Overpoch Napf server as well and had exactly the same issue, I ended up just placing it on something else. You can always just add one of those fuel pumps to each station manually as well.

Link to comment
Share on other sites

@Havoc302

 

do you also have infistar Antihack?

 

what u  mean with placing on something else?

 

what u mean with adding fuelpumps?  on my gas stations there are fuelpumps.. i can attach a generator to them and fuel the generators to run the fuelpumps. but thats not autorefuel like i want to have...

 

cheers

Link to comment
Share on other sites

@Havoc302

 

do you also have infistar Antihack?

 

what u  mean with placing on something else?

 

what u mean with adding fuelpumps?  on my gas stations there are fuelpumps.. i can attach a generator to them and fuel the generators to run the fuelpumps. but thats not autorefuel like i want to have...

 

cheers

I do, I just added it to the exceptions.

 

I placed it on the refueling trucks at first now I've got it on the rearming trucks.

 

For some reason it doesn't seem to work on the default Napf fuel pumps even though they're the correct class name. You can just add some other ones using the F2 infistar menu.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...