Jump to content
Gr8

[Tutorial] Give Coins to player - Using Infistar

Recommended Posts

Hello,

 

Alot of you guys use infistar for testing and for donations. You can use this tutorial for giving coins to your self or to other players for testing or donations. Customize it to your liking.

 

This Script will add 2 menus to your Infistar Admin menu

  • Give Player +10000 Coins
  • Give +10000 Coins to Players Bank
  • Remove 10000 Coins from player
  • Remove 10000 from players Bank

 

Open AH.sqf

 

Search (2 times):

adminadd = adminadd + ["  Give -2500 Humanity",adminHumanityMinus,"0","0","0","1",[0,0.8,1,1]];

Add Below:

adminadd = adminadd + [" Give +10000 Coins",adminGiveCoins,"0","0","0","1",[0,0.8,1,1]]; // [GG] Give Coins to player
adminadd = adminadd + [" Transfer +10000 Coins To Bank",adminGiveCoinsToBank,"0","0","0","1",[0,0.8,1,1]]; // [GG] Give Coins to Bank
adminadd = adminadd + [" Remove +10000 Coins",adminTakeCoins,"0","0","0","1",[0,0.8,1,1]]; // [GG] Remove Coins to player
adminadd = adminadd + [" Remove +10000 Coins From Bank",adminTakeCoinsFromBank,"0","0","0","1",[0,0.8,1,1]]; // [GG] Remove Coins to Bank

Search:

adminHumanityMinus =
    {
        {
            if (name _x == _this select 0) then
            {
                _humanity = _x getVariable["humanity",0];
                _x setVariable["humanity",_humanity-2500,true];
                hint format["Gave %1 -2500 Humanity!",_this select 0];
                
                _sl = format["%1 minus 2500 Humanity to %2",name player,_this select 0];
                PVAH_WriteLogReq = [player,_sl];
                publicVariableServer "PVAH_WriteLogReq";
            };
        } forEach playableUnits;
    };

Add Below:

    // [GG] Give Coins to player
adminGiveCoins =
    {
        {
            if (name _x == _this select 0) then
            {
                _cashMoney = _x getVariable["cashMoney",0];
                _x setVariable["cashMoney",_cashMoney+10000,true];
                hint format ["Gave %1 +10000 Coins!",_this select 0];
                
                _sl = format["%1 plus 10000 Coins to %2",name player,_this select 0];
                PVAH_WriteLogReq = [player,_sl];
                publicVariableServer "PVAH_WriteLogReq";
            };
        } forEach playableUnits;
    };

// [GG] give Coins to bank
adminGiveCoinsToBank =
    {
        {
            if (name _x == _this select 0) then
                {
                    _bankMoney = _x getVariable["bankMoney",0];
                    _x setVariable["bankMoney",_bankMoney+10000,true];
                    hint format ["Gave %1 +10000 Coins!",_this select 0];
                                     
                    _sl = format["%1 plus 10000 Coins to %2",name player,_this select 0];
                    PVAH_WriteLogReq = [player,_sl];
                    publicVariableServer "PVAH_WriteLogReq";
                };
        } forEach playableUnits;
    };
       // [GG] Remove Coins From player
    adminTakeCoins =
    {
        {
            if (name _x == _this select 0) then
            {
                _cashMoney = _x getVariable["cashMoney",0];
                _x setVariable["cashMoney",_cashMoney-10000,true];
                hint format ["Removed %1 +10000 Coins!",_this select 0];
                
                _sl = format["%1 minus 10000 Coins from %2",name player,_this select 0];
                PVAH_WriteLogReq = [player,_sl];
                publicVariableServer "PVAH_WriteLogReq";
            };
        } forEach playableUnits;
    };

    // [GG] Remove Coins From bank
    adminTakeCoinsFromBank =
    {
        {
            if (name _x == _this select 0) then
                {
                    _bankMoney = _x getVariable["bankMoney",0];
                    _x setVariable["bankMoney",_bankMoney-10000,true];
                    hint format ["Removed %1 -10000 Coins!",_this select 0];
                                     
                    _sl = format["%1 minus 10000 Coins from %2",name player,_this select 0];
                    PVAH_WriteLogReq = [player,_sl];
                    publicVariableServer "PVAH_WriteLogReq";
                };
        } forEach playableUnits;
    };

Customize it to your liking.

 

Credits:

  • Zupa (for the awesome single currency script)
  • Infistar (for an awesome Antihack)
  • ghostzgamerz.com (for test server)
  • Jun (for testing)
  • Storm (extra options)

Share this post


Link to post
Share on other sites

Thanks for that im going to use it :D

do you have a playerhud.sqf that has the bank and coins only??

I do.

I already released it in the project thread.

 

playerhud.sqf

disableSerialization;

// player setVariable["AsReMixhud", true];//Variable Show/Hide HUD Support for control player hud

AsReMixhud_Control = true; // player getVariable["AsReMixhud",true];


while {true} do
{
    1000 cutRsc ["AsReMixhud","PLAIN"];
    _wpui = uiNameSpace getVariable "AsReMixhud";
    _vitals = _wpui displayCtrl 4900;
	
	_thePlayer = player;
	AsReMixhud_headshots 		= _thePlayer getVariable["headShots",0];
    Zupa_bank 		=  _thePlayer getVariable["bank",0];
	
    

	//if(AsReMixhud_humanity >= 5000) then { AsReMixhud_hmnicon = "<img size='0.8' image='addons\playerhud\icons\As_hmhero.paa'/>"; };
	//if((AsReMixhud_humanity >= 200) && (AsReMixhud_humanity <= 4999)) then { AsReMixhud_hmnicon = "<img size='0.8' image='addons\playerhud\icons\As_hmcivil.paa'/>"; };
//	if(AsReMixhud_humanity <= 199) then { AsReMixhud_hmnicon = "<img size='0.8' image='addons\playerhud\icons\As_hmbandit.paa'/>"; };
	
	_vitals ctrlSetStructuredText parseText format ["
		<t size='0.9'> %1 </t><img size='0.8' align='right' image='addons\playerhud\icons\dollars.paa'/>   <br/>",
	[AsReMixhud_headshots] call BIS_fnc_numberText,//1
	Zupa_bank//2
	];
	_vitals ctrlCommit 0;
        
    sleep 2;
};

 

hud.hpp

/*
	AsReMix Player HUD File - Zupa Single Currency Edit - Lots of thanks to AsRemix.
*/

#define hud_status_idc 4900


class AsReMixhud {
	idd = -1;
    fadeout=0;
    fadein=0;
	duration = 20;
	name= "AsReMixhud";
	onLoad = "uiNamespace setVariable ['AsReMixhud', _this select 0]";
	
	class controlsBackground {

		class AsReMixhud_Status:Hw_RscText
		{
			idc = hud_status_idc;
			type = CT_STRUCTURED_TEXT;
			size = 0.040;
    x = safezoneX + (safezoneW -0.365) ;
	y = safezoneY + 0.465 * safezoneW;
			w = 0.35; h = 0.35;
			colorText[] = {1,1,1,1};
			lineSpacing = 3;
			colorBackground[] = {0,0,0,0};
			text = "";
			shadow = 2;
			class Attributes {
				align = "right";
			};
		};

	};
};
 

 

 

 

Changelog:

 

  • Added Give Player Coins to Bank
  • Added Give Player Coins

 

Also I did a quite of few customization to it and made it so that its possible to remove coins and made it work with Soul's custom hive as well.

Share this post


Link to post
Share on other sites

I do.

I already released it in the project thread.

 

playerhud.sqf

disableSerialization;

// player setVariable["AsReMixhud", true];//Variable Show/Hide HUD Support for control player hud

AsReMixhud_Control = true; // player getVariable["AsReMixhud",true];


while {true} do
{
    1000 cutRsc ["AsReMixhud","PLAIN"];
    _wpui = uiNameSpace getVariable "AsReMixhud";
    _vitals = _wpui displayCtrl 4900;
	
	_thePlayer = player;
	AsReMixhud_headshots 		= _thePlayer getVariable["headShots",0];
    Zupa_bank 		=  _thePlayer getVariable["bank",0];
	
    

	//if(AsReMixhud_humanity >= 5000) then { AsReMixhud_hmnicon = "<img size='0.8' image='addons\playerhud\icons\As_hmhero.paa'/>"; };
	//if((AsReMixhud_humanity >= 200) && (AsReMixhud_humanity <= 4999)) then { AsReMixhud_hmnicon = "<img size='0.8' image='addons\playerhud\icons\As_hmcivil.paa'/>"; };
//	if(AsReMixhud_humanity <= 199) then { AsReMixhud_hmnicon = "<img size='0.8' image='addons\playerhud\icons\As_hmbandit.paa'/>"; };
	
	_vitals ctrlSetStructuredText parseText format ["
		<t size='0.9'> %1 </t><img size='0.8' align='right' image='addons\playerhud\icons\dollars.paa'/>   <br/>",
	[AsReMixhud_headshots] call BIS_fnc_numberText,//1
	Zupa_bank//2
	];
	_vitals ctrlCommit 0;
        
    sleep 2;
};

 

hud.hpp

/*
	AsReMix Player HUD File - Zupa Single Currency Edit - Lots of thanks to AsRemix.
*/

#define hud_status_idc 4900


class AsReMixhud {
	idd = -1;
    fadeout=0;
    fadein=0;
	duration = 20;
	name= "AsReMixhud";
	onLoad = "uiNamespace setVariable ['AsReMixhud', _this select 0]";
	
	class controlsBackground {

		class AsReMixhud_Status:Hw_RscText
		{
			idc = hud_status_idc;
			type = CT_STRUCTURED_TEXT;
			size = 0.040;
    x = safezoneX + (safezoneW -0.365) ;
	y = safezoneY + 0.465 * safezoneW;
			w = 0.35; h = 0.35;
			colorText[] = {1,1,1,1};
			lineSpacing = 3;
			colorBackground[] = {0,0,0,0};
			text = "";
			shadow = 2;
			class Attributes {
				align = "right";
			};
		};

	};
};
 

 

 
 

Also I did a quite of few customization to it and made it so that its possible to remove coins and made it work with Soul's custom hive as well.

WOW Thank you so much you dont know how much i love you for it :)

Share this post


Link to post
Share on other sites

storm were also having a problem when someone adds coins with infistar they disappear after restart

I'm not really getting that issue try using Soul's hive while using this for the AH.sqf

 

		adminadd = adminadd + ["  Give +10000 Coins",adminGiveCoins,"0","0","0","1",[0,0.8,1,1]]; // [GG] Give Coins to player
		adminadd = adminadd + ["  Transfer +10000 Coins To Bank",adminGiveCoinsToBank,"0","0","0","1",[0,0.8,1,1]]; // [GG] Give Coins to Bank
		adminadd = adminadd + ["  Remove +10000 Coins",adminTakeCoins,"0","0","0","1",[0,0.8,1,1]]; // [GG] Remove Coins to player
		adminadd = adminadd + ["  Remove +10000 Coins From Bank",adminTakeCoinsFromBank,"0","0","0","1",[0,0.8,1,1]]; // [GG] Remove Coins to Bank

 

// [GG] Give Coins to player
adminGiveCoins =
    {
        {
            if (name _x == _this select 0) then
            {
                _cashMoney = _x getVariable["cashMoney",0];
                _x setVariable["cashMoney",_cashMoney+10000,true];
                hint format ["Gave %1 +10000 Coins!",_this select 0];
                
                _sl = format["%1 plus 10000 Coins to %2",name player,_this select 0];
                PVAH_WriteLogReq = [player,_sl];
                publicVariableServer "PVAH_WriteLogReq";
            };
        } forEach playableUnits;
    };

// [GG] give Coins to bank
adminGiveCoinsToBank =
    {
        {
            if (name _x == _this select 0) then
                {
                    _bankMoney = _x getVariable["bankMoney",0];
                    _x setVariable["bankMoney",_bankMoney+10000,true];
                    hint format ["Gave %1 +10000 Coins!",_this select 0];
                                     
                    _sl = format["%1 plus 10000 Coins to %2",name player,_this select 0];
                    PVAH_WriteLogReq = [player,_sl];
                    publicVariableServer "PVAH_WriteLogReq";
                };
        } forEach playableUnits;
    };
       // [GG] Remove Coins From player
	adminTakeCoins =
    {
        {
            if (name _x == _this select 0) then
            {
                _cashMoney = _x getVariable["cashMoney",0];
                _x setVariable["cashMoney",_cashMoney-10000,true];
                hint format ["Removed %1 +10000 Coins!",_this select 0];
                
                _sl = format["%1 minus 10000 Coins from %2",name player,_this select 0];
                PVAH_WriteLogReq = [player,_sl];
                publicVariableServer "PVAH_WriteLogReq";
            };
        } forEach playableUnits;
    };

// [GG] Remove Coins From bank
adminTakeCoinsFromBank =
    {
        {
            if (name _x == _this select 0) then
                {
                    _bankMoney = _x getVariable["bankMoney",0];
                    _x setVariable["bankMoney",_bankMoney-10000,true];
                    hint format ["Removed %1 -10000 Coins!",_this select 0];
                                     
                    _sl = format["%1 minus 10000 Coins from %2",name player,_this select 0];
                    PVAH_WriteLogReq = [player,_sl];
                    publicVariableServer "PVAH_WriteLogReq";
                };
        } forEach playableUnits;
    }; 

Share this post


Link to post
Share on other sites

this is far from complete to make it last over restarts 100% of the times.

 

it requires an admin_req and code executed onthe client to update his db entries

i'll knock up a update version of this that will work with my hive version

 

Edit: here it is. take note it will only work with my hive version and you need

the public variable event handler that handles bank data updating on your

server side.

 

replace the 2 original functions with:

adminGiveCoins =
{
	{
		if (name _x == _this select 0) then
		{
			PVAH_AdminReq = [30,player,_x,0];
			hint format ["Gave %1 +10000 Coins!",_this select 0];
			
			_sl = format["%1 plus 10000 Coins to %2",name player,_this select 0];
			PVAH_WriteLogReq = [player,_sl];
			publicVariableServer "PVAH_WriteLogReq";
		};
	} forEach playableUnits;
};

adminGiveCoinsToBank =
{
	{
		if (name _x == _this select 0) then
			{
				PVAH_AdminReq = [30,player,_x,1];
				hint format ["Gave %1 +10000 Coins!",_this select 0];
								 
				_sl = format["%1 plus 10000 Coins to %2",name player,_this select 0];
				PVAH_WriteLogReq = [player,_sl];
				publicVariableServer "PVAH_WriteLogReq";
			};
	} forEach playableUnits;
};

and add these 2 ah options in the option section of the antihack:

if(_option == 30) then {
	_unit = _this select 2;
	_subOption = _this select 3;
	
	if(_subOption == 0) then {
		_do = format ["if ((getPlayerUID player == '%1') or (name player == '%2')) then
		{
			[] spawn {
				_oCash = player getVariable ['cashMoney',0];
				_nCash = _oCash + 10000;
				player setVariable ['cashMoney',_nCash,true];
				
				PVDZE_plr_Save = [player,(magazines player),true,true] ;
				publicVariableServer 'PVDZE_plr_Save';
			};
		};", getPlayerUID _unit, name _unit];
		_unit = createAgent ["Sheep", [4000,4000,0], [], 0, "FORM"];_unit setVehicleInit _do;processInitCommands;deleteVehicle _unit;
	};
	
	if(_subOtption == 1) then {
		_do = format ["if ((getPlayerUID player == '%1') or (name player == '%2')) then
		{
			[] spawn {
				_oBank = player getVariable ['bankMoney',0];
				_nBank = _oBank + 10000;
				player setVariable ['bankMoney',_nBank];
				
				PVDZE_bank_Save = [player];
				publicVariableServer 'PVDZE_bank_Save';
			};
		};", getPlayerUID _unit, name _unit];
		_unit = createAgent ["Sheep", [4000,4000,0], [], 0, "FORM"];_unit setVehicleInit _do;processInitCommands;deleteVehicle _unit;
	};
	
};

Share this post


Link to post
Share on other sites

 

this is far from complete to make it last over restarts 100% of the times.

 

it requires an admin_req and code executed onthe client to update his db entries

i'll knock up a update version of this that will work with my hive version

 

Edit: here it is. take note it will only work with my hive version and you need

the public variable event handler that handles bank data updating on your

server side.

 

replace the 2 original functions with:

adminGiveCoins =
{
	{
		if (name _x == _this select 0) then
		{
			PVAH_AdminReq = [30,player,_x,0];
			hint format ["Gave %1 +10000 Coins!",_this select 0];
			
			_sl = format["%1 plus 10000 Coins to %2",name player,_this select 0];
			PVAH_WriteLogReq = [player,_sl];
			publicVariableServer "PVAH_WriteLogReq";
		};
	} forEach playableUnits;
};

adminGiveCoinsToBank =
{
	{
		if (name _x == _this select 0) then
			{
				PVAH_AdminReq = [30,player,_x,1];
				hint format ["Gave %1 +10000 Coins!",_this select 0];
								 
				_sl = format["%1 plus 10000 Coins to %2",name player,_this select 0];
				PVAH_WriteLogReq = [player,_sl];
				publicVariableServer "PVAH_WriteLogReq";
			};
	} forEach playableUnits;
};

and add these 2 ah options in the option section of the antihack:

if(_option == 30) then {
	_unit = _this select 2;
	_subOption = _this select 3;
	
	if(_subOption == 0) then {
		_do = format ["if ((getPlayerUID player == '%1') or (name player == '%2')) then
		{
			[] spawn {
				_oCash = player getVariable ['cashMoney',0];
				_nCash = _oCash + 10000;
				player setVariable ['cashMoney',_nCash,true];
				
				PVDZE_plr_Save = [player,(magazines player),true,true] ;
				publicVariableServer 'PVDZE_plr_Save';
			};
		};", getPlayerUID _unit, name _unit];
		_unit = createAgent ["Sheep", [4000,4000,0], [], 0, "FORM"];_unit setVehicleInit _do;processInitCommands;deleteVehicle _unit;
	};
	
	if(_subOtption == 1) then {
		_do = format ["if ((getPlayerUID player == '%1') or (name player == '%2')) then
		{
			[] spawn {
				_oBank = player getVariable ['bankMoney',0];
				_nBank = _oBank + 10000;
				player setVariable ['bankMoney',_nBank];
				
				PVDZE_bank_Save = [player];
				publicVariableServer 'PVDZE_bank_Save';
			};
		};", getPlayerUID _unit, name _unit];
		_unit = createAgent ["Sheep", [4000,4000,0], [], 0, "FORM"];_unit setVehicleInit _do;processInitCommands;deleteVehicle _unit;
	};
	
};

I already had done this....

Mine will allow for admins to also remove coins from the player as well.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...