Jump to content

[Release] Paycheck/Loyality Reward


Cherdenko

Recommended Posts

Edit: Credit to @BigEgg for base script

 

Hello guys, today i came up  with a little script that gives players Money based on their time on the server.

there is a multiplicator included that gives you more money every time, until the 4th time is reached. this is the highest possible Tier

needs to be initialized with :

[] execVM "YOUR_PATH_TO\paycheck.sqf";

in the if (!isDedicated) Section in the init.sqf

Spoiler

/*
Original thread:
https://epochmod.com/forum/topic/44337-release-paycheckloyality-reward/
*/


private["_Ran", "_Amount", "_Delay","_Wallet","_multiplier","_posAlt","_posNew","_posDistance"];


_Amount =10000; // change to your liking
_Delay = 100; // change to your liking

// Do not change
_Ran = 0;
_multiplier = 1; 
// Do not change




while {_Ran < 2} do 
{

_Amount = _Amount*_multiplier;


    if (_Ran == 1) then {
	
	_posNew = getPos (vehicle player);
	_posDistance= round(_posAlt distance _posNew);
	if (_posDistance< 50) then {
	systemChat format["[Server-name]: You did not move %1 ... No reward to claim, Multiplicator reset", name player];
	_multiplier = 1;
	_Ran =0;
	
	}else{
		_Wallet = player getVariable[Z_MoneyVariable, 0];
        player setVariable[Z_MoneyVariable, _Wallet + _Amount, true];
        call player_forceSave;
        systemChat format["[Server-Name]: %1 - Pay Check Time %2 Coins! Thank you for playing on Server-Name! You are currently on Tier %3", name player, _Amount,_multiplier];
        _Ran = 0;
		
		if(_multiplier<4)then{
		_multiplier = _multiplier +1;
		};
		
	};
		
};
    _Ran = _Ran + 1;
	_posAlt = getPos (vehicle player);
    uiSleep _Delay;

};

 

Base Script without any multiplicator:
@NateDayZ there you go.
edited this on my smartphone so sry if it looks a bit bad

Spoiler



/*
Original thread:
https://epochmod.com/forum/topic/44337-release-paycheckloyality-reward/
*/


private["_Ran", "_Amount", "_Delay","_Wallet"];


_Amount =10000; // change to your liking
_Delay = ; // change to your liking

// Do not change
_Ran = 0;
// Do not change




while {_Ran < 2} do 
{



    if (_Ran == 1) then {
	
	
		_Wallet = player getVariable[Z_MoneyVariable, 0];
        player setVariable[Z_MoneyVariable, _Wallet + _Amount, true];
        call player_forceSave;
        systemChat format["[Server-Name]: %1 - Pay Check Time %2 Coins! Thank you for playing on Server-Name!", name player, _Amount];
        _Ran = 0;
		
		
	};
		

    _Ran = _Ran + 1;
	
    uiSleep _Delay;

};

 

original script by @BigEgg:

Spoiler

private["_Ran", "_Amount", "_Delay", "_nearestPlots", "_isNearPlot", "_udderWallet"];

_Ran = 0;
_Amount = 2500;
_Delay = 900;

while {_Ran < 2} do 
{
    if (_Ran == 1) then {
		if (isInTraderCity) exitWith {
            systemChat format["[UDDER-AH]: %1 - You cannot claim your reward if you are in a safezone!", name player];
            _Ran = 0;
        };
		_nearestPlots = vehicle player nearEntities["Plastic_Pole_EP1_DZ", DZE_PlotPole select 0];
		_isNearPlot = count(_nearestPlots);
        if (_isNearPlot > 0) exitWith {
            systemChat format["[UDDER-AH]: %1 - You cannot claim your reward if you are within %2m of a base!", name player, DZE_PlotPole select 0];
            _Ran = 0;
        };
		_udderWallet = player getVariable[Z_MoneyVariable, 0];
        player setVariable[Z_MoneyVariable, _udderWallet + _Amount, true];
        systemChat format["[UDDER-AH]: %1 - Your wallet has been credited with 2,500 Gold Coins! Thank you for playing on UDDER!", name player];
        _Ran = 0;
    };
    _Ran = _Ran + 1;
    uiSleep _Delay;
};

 

as allways have fun :)

Link to comment
Share on other sites

@NateDayZ there you go.
edited this on my smartphone so sry if it looks a bit bad

/*
Original thread:
https://epochmod.com/forum/topic/44337-release-paycheckloyality-reward/
*/


private["_Ran", "_Amount", "_Delay","_Wallet"];


_Amount =10000; // change to your liking
_Delay = ; // change to your liking

// Do not change
_Ran = 0;
// Do not change




while {_Ran < 2} do 
{



    if (_Ran == 1) then {
	
	
		_Wallet = player getVariable[Z_MoneyVariable, 0];
        player setVariable[Z_MoneyVariable, _Wallet + _Amount, true];
        call player_forceSave;
        systemChat format["[Server-Name]: %1 - Pay Check Time %2 Coins! Thank you for playing on Server-Name!", name player, _Amount];
        _Ran = 0;
		
		
	};
		

    _Ran = _Ran + 1;
	
    uiSleep _Delay;

};
Link to comment
Share on other sites

Be careful with these kinds of scripts, we had it in our server, and when we reached 40-50 players our loyalty script just crapped the bed, it gave players the amount of money "any" so they could withdraw and deposit infinite amounts of money, I am not saying this to discourage anyone but to encourage that someone makes a safeguard against it.

good work though!!!

Link to comment
Share on other sites

Jesus Christ, as if it couldn't get any better. If you are going to steal code out of my mission file, change a few lines and comments, and release it, at least give me some credits. This is even worse than the version I had in my mission file which checked if they were in a trader, or if they were near a base.

Link to comment
Share on other sites

private["_Ran", "_Amount", "_Delay", "_nearestPlots", "_isNearPlot", "_udderWallet"];

_Ran = 0;
_Amount = 2500;
_Delay = 900;

while {_Ran < 2} do 
{
    if (_Ran == 1) then {
		if (isInTraderCity) exitWith {
            systemChat format["[UDDER-AH]: %1 - You cannot claim your reward if you are in a safezone!", name player];
            _Ran = 0;
        };
		_nearestPlots = vehicle player nearEntities["Plastic_Pole_EP1_DZ", DZE_PlotPole select 0];
		_isNearPlot = count(_nearestPlots);
        if (_isNearPlot > 0) exitWith {
            systemChat format["[UDDER-AH]: %1 - You cannot claim your reward if you are within %2m of a base!", name player, DZE_PlotPole select 0];
            _Ran = 0;
        };
		_udderWallet = player getVariable[Z_MoneyVariable, 0];
        player setVariable[Z_MoneyVariable, _udderWallet + _Amount, true];
        systemChat format["[UDDER-AH]: %1 - Your wallet has been credited with 2,500 Gold Coins! Thank you for playing on UDDER!", name player];
        _Ran = 0;
    };
    _Ran = _Ran + 1;
    uiSleep _Delay;
};

Funny how similar it looks, am I right? While all you did is remove stuff, you didn't even change the variable names. It's a simple ass script, but at least give some credit.

 

EDIT: It also looks like you took it before I removed the player_forceSave call which was annoying my players.

Link to comment
Share on other sites

well first off i did not steal it from your server, ive never been on your server, as i just use european servers.
i did see that script a long time ago when a friend sent me that script for 1051,  and was figuring out how to do it in 1.0.6.1 +multiplicator so i didn't know if it was your code.

if it is indeed your code, then im sorry and will correctly give credit to you. @BigEgg

Link to comment
Share on other sites

2 minutes ago, Cherdenko said:

well first off i did not steal it from your server, ive never been on your server, as i just use european servers.
i did see that script a long time ago when a friend sent me that script for 1051,  and was figuring out how to do it in 1.0.6.1 +multiplicator so i didn't know if it was your code.

if it is indeed your code, then im sorry and will correctly give credit to you. @BigEgg

Thanks.

 

Who is your friend? I bet I know who it is, just curious ;)

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
  • Discord

×
×
  • Create New...