Jump to content

[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)
Link to comment
Share on other sites

  On 8/9/2014 at 5:44 AM, NGHD said:

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

  Reveal hidden contents

 

hud.hpp

  Reveal hidden contents

 

 
  On 8/9/2014 at 5:43 AM, Gr8Boi said:

 

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.

Link to comment
Share on other sites

  On 8/9/2014 at 10:32 PM, Storm said:

I do.

I already released it in the project thread.

 

playerhud.sqf

  Reveal hidden contents

 

hud.hpp

  Reveal hidden contents

 

 
 

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 :)

Link to comment
Share on other sites

  On 8/10/2014 at 2:34 AM, Jun said:

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

 

  Reveal hidden contents

 

  Reveal hidden contents

Link to comment
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;
	};
	
};
Link to comment
Share on other sites

  On 8/10/2014 at 2:44 PM, Soul said:

 

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.

Link to comment
Share on other sites

  On 8/17/2014 at 10:17 PM, YuriLowell said:

Any way of making it so the values dont go below 0? for example if i take 10k coins from a guy with only 10 coins it will go to -9990 coins.

use this addition instead ( Im sorry gr8boi, but this one was linked in offical thread way before you made this post ^^)

http://devzupa.be/forum/viewtopic.php?id=3

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

×
×
  • Create New...