Jump to content

[Release] Single Currency Axe Cop Service Points for SC


Recommended Posts

 

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. 

 

 

Edit: fix below

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. 

 

 

Change your remove coins function to this

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(_amount > 0)then{
                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";            
                };
                }else{
                _result = true;
                };
                _result
    };

This checkts if the value given = 0 , then it always succes

 

EDIT: Also edited the functions at DEV post.

Link to comment
Share on other sites

 

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
};	

 

 

 

 

Yes i am using the new one Zupa just posted i will post the one i have changed and hopefully one of you can tell me why no options come up at all and no errors in server or client rpt

 

 

http://pastebin.com/bXr9Ye5g

 

Thanks in advanced!

Link to comment
Share on other sites

Sorry who can share completed?

 

I'm noob. I can not do it work.

 

 

 

Who can help me?

 

Please! Tell me what me wrong?

 

https://dl.dropboxusercontent.com/u/90267497/DayZ%20Script/service_point.rar

 

 

 

 

In  compiles.sqf

 

http://pastebin.com/RLQaFE57

It looks like you missed a square bracket on line 39 (["Air",[CurrencyName,_coinsRepairAir], / should be ["Air",[CurrencyName,_coinsRepairAir]], /

 

Are you using the updated add/remove coins script from Zupa? If not try it.

 

Here try my service_point.sqf:   http://pastebin.com/rHkN8VCn

Link to comment
Share on other sites

Anyone having any problems with this still?
i've compiled all of the fixes into one RAR for you people who can't be bothered looking.

And here's the link, don't forget to thank the people below!

Souls 2.0 service points - https://www.dropbox.com/s/e9816xlgwzjwzwf/Service-Point%20Complete%20%28Souls%202.0%29.rar?dl=0

Thanks to:
Zupa (For single currency and compiles addon)
Soul (For his HIVE)
Axe Cop (For service point)
Kat (For the changes to service point for Souls 2.0)
Rocu (For the "Perfectionist" fix)

 

Link to comment
Share on other sites

Sorry if I didn't express myself correctly. I Didn't really hint that *you* should do it, just that it needs to be done :D . But hey, if you're up for it, kudos for you. It's quite a task. 

Like i said, I will get around to doing it. Think it would be good since so many people are actually having problems adding it

Link to comment
Share on other sites

I am trying to limit the magazine count based on vehicle classname...

I cannot seem to get the Array down.

 

I am not sure if this would even work in an array...?

//_rearm_magazineCount = 1; // amount of magazines to be added to the vehicle weapon
_magazineCount = [
        ["Mi171Sh_rocket_CZ_EP1",[1]],
        ["ArmoredSUV_PMC_DZE",[2]],
        ["Air",[2]],
        ["AllVehicles",[3]]];

My attempt at the function...

_fnc_getMagCount = {
        private ["_vehicle","_count"];
        _vehicle = _this select 0;
        _count = _this select 1;
        {
                private "_typeName";
                _typeName = _x select 0;
                if (_vehicle isKindOf _typeName) exitWith {
                        _count = _x select 1;
                };
        }
};

Not sure where or how to make that happen here... Can anyone give me a hand?

if ((_role call _fnc_isArmed) && (count SP_rearm_actions == 0) && _rearm_enable) then {
                                private ["_weapons"];
                                _costs = [_vehicle, _rearm_costs] call _fnc_getCosts;
                                _count = [_vehicle, _magazineCount] call _fnc_getMagCount;
                                _weapons = [_vehicle, _role] call _fnc_getWeapons;
                                {
                                        private "_weaponName";
                                        _weaponName = _x select 1;
                                        _actionTitle = [format["Rearm %1", _weaponName], _costs] call _fnc_actionTitle;
                                        SP_rearm_action = _vehicle addAction [_actionTitle, _folder + "service_point_rearm.sqf", [_servicePoint, _costs, _count, _x], -1, false, true, "", _actionCondition];
                                        SP_rearm_actions set [count SP_rearm_actions, SP_rearm_action];
                                } forEach _weapons;
                        };
Link to comment
Share on other sites

Thanks for the work that everyone has done on this, it is fantastic.

 

I am having 1 small problem which I haven't been able to track down with my limited knowledge.  I have the script running and working but on the scroll menu the currency showing as "Any" instead of coins for rearm and repair.  I am running a version of Zupa Single Currency with some changes (not to the name of the currency) and using standard .dll's.  I followed the first post instruction and the updates in post 10.  If anyone is able to help me resolve this or point me in the right direction it would be most appreciated, it is the only thing I need to fix to go live with it.

Link to comment
Share on other sites

Thanks for the work that everyone has done on this, it is fantastic.

 

I am having 1 small problem which I haven't been able to track down with my limited knowledge.  I have the script running and working but on the scroll menu the currency showing as "Any" instead of coins for rearm and repair.  I am running a version of Zupa Single Currency with some changes (not to the name of the currency) and using standard .dll's.  I followed the first post instruction and the updates in post 10.  If anyone is able to help me resolve this or point me in the right direction it would be most appreciated, it is the only thing I need to fix to go live with it.

Did you add the Dev function to your Variables?

Link to comment
Share on other sites

Did you add the Dev function to your Variables?

 

I have made a new file with that as the contents and called it from my custom compiles.  The script works fine in the regard or using coins to rearm and repair and takes the specified amount from my cash on hand, it is just the currency name that is incorrect on the scroll menu.

 

dbFMjLl.png

 

I have found the name "CurrencyName in the service_points.sqf and also checked that the same term is used within the Zupa coins to specify the name of the currency, but not entirely sure how to get it to work on the scroll menu.

 

Edit:              To update on this further, I have also tried to put the dev function directly into the custom compiles.sqf without any luck.

 

Would there be a way to just type the currency name (ie. coins) instead of calling the value from somewhere else?

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...