Jump to content

infiSTAR Antihack preventing give money to player


Recommended Posts

So infiSTAR antihack is preventing regular players from giving eachother coins. When they try to give eachother coins they receive "You can only give money to a player"

Ive tried whitelisting the following dialogues but so far no joy 14000,14001,14003
Here is the block of code that handles this function.

GivePlayerAmount = {


    private ["_amount","_target","_wealth"];
    
    _amount = parseNumber (_this select 0);
    _target = cursorTarget;
    _wealth = player getVariable["cashMoney",0];
    _twealth = _target getVariable["cashMoney",0];
    _isMan = _target in playableUnits;

    if (_amount < 1 or _amount > _wealth) exitWith {
        cutText ["You can not give more than you currently have.", "PLAIN DOWN"];
    };

    if (!_isMan) exitWith {
        cutText ["You can only give money to a player", "PLAIN DOWN"];
    };

    player setVariable["cashMoney",_wealth - _amount, true];

    _target setVariable["cashMoney",_twealth + _amount, true];

    PVDZE_plr_Save = [player,(magazines player),true,true] ;
    publicVariableServer "PVDZE_plr_Save";
    PVDZE_plr_Save = [_target,(magazines _target),true,true] ;
    publicVariableServer "PVDZE_plr_Save";

    cutText [format["You gave %1 %2.", _amount, CurrencyName], "PLAIN DOWN"];
};

Does anyone know how to resolve this?

Link to comment
Share on other sites

Thats the code block i added to the coon system to prevent coin loss when giving coins to players.

Make sure youre looking at the player while giving coins, it happens often with lag

It's not lag related. Admins can give coins to players fine. Non admin players cannot give coins to players. Before I whitelisted those dialogues the player would receive the "You can only give money to a player" as soon as they selected the action from the mouse wheel. Once I  whitelisted those dialogues, and now the give coin dialogue opens up, but when they try to transfer any amount of money they receive "You can only give money to a player."  Everything else about the coin system functions properly except this. Is it possibly an antidupe feature of the antihack?

Link to comment
Share on other sites

idk what to double check,  because it works for admins just not other players. So i believe the code is fine, but theres something w/ the antihack blocking it. Here's my gold/init.sqf maybe you can spot something but I wouldn't know what to double check.

 

BankDialogTransferAmount = 13000;


BankDialogPlayerBalance = 13001;
BankDialogBankBalance = 13002;
SCTraderDialogCatList = 32000;
SCTraderDialogItemList = 32001;
SCTraderDialogBuyPrice = 32002;
SCTraderDialogSellPrice = 32003;
GivePlayerDialogTransferAmount = 14000;
GivePlayerDialogPlayerBalance = 14001;

BankDialogUpdateAmounts = {
    ctrlSetText [bankDialogPlayerBalance, format["%1 %2", (player getVariable ['cashMoney', 0] call BIS_fnc_numberText), CurrencyName]];
    ctrlSetText [bankDialogBankBalance, format["%1 %2", (player getVariable ['bankMoney', 0] call BIS_fnc_numberText), CurrencyName]];
};

GivePlayerDialogAmounts = {
    ctrlSetText [GivePlayerDialogPlayerBalance, format["%1 %2", (player getVariable ['cashMoney', 0] call BIS_fnc_numberText), CurrencyName]];
    ctrlSetText [14003, format["%1", (name cursorTarget)]];
};

BankDialogWithdrawAmount = {

    private ["_amount","_bank","_wealth"];

    _amount = parseNumber (_this select 0);    
    _bank = player getVariable ["bankMoney", 0];
    _wealth = player getVariable["cashMoney",0];
    
    if(_amount > 999999) exitWith { cutText ["You can not withdraw more then 999,999 coins at once.", "PLAIN DOWN"]; };
    if(_amount < 1 or _amount > _bank) exitWith { cutText ["You can not withdraw more than is in your bank.", "PLAIN DOWN"]; };

    player setVariable["cashMoney",(_wealth + _amount),true];
    player setVariable["bankMoney",(_bank - _amount),true];

    PVDZE_plr_Save = [player,(magazines player),true,true] ;
    publicVariableServer "PVDZE_plr_Save";

    PVDZE_bank_Save = [player];
    publicVariableServer "PVDZE_bank_Save";

    cutText [format["You have withdrawn %1 %2.", [_amount] call BIS_fnc_numberText, CurrencyName], "PLAIN DOWN"];

};

BankDialogDepositAmount = {

    private ["_amount","_bank","_wealth"];

    _amount = parseNumber (_this select 0);
    _bank = player getVariable ["bankMoney", 0];
    _wealth = player getVariable["cashMoney",0];

    if(_amount > 999999) exitWith { cutText ["You can not deposit more then 999,999 coins at once.", "PLAIN DOWN"]; };
    if (_amount < 1 or _amount > _wealth) exitWith { cutText ["You can not deposit more than you have.", "PLAIN DOWN"]; };

    if(LimitOnBank && ((_bank + _amount ) >  MaxBankMoney )) then {
    if( (getPlayerUID player in DonatorBank ) && ((_bank + _amount ) <  MaxDonatorBankMoney )) then {
        player setVariable["cashMoney",(_wealth - _amount),true];
        player setVariable["bankMoney",(_bank + _amount),true];        
        cutText [format["You have deposited %1 %2.", [_amount] call BIS_fnc_numberText, CurrencyName], "PLAIN DOWN"];            
    } else {
        cutText [format["You can only have a max of %1 %3, donators %2", [MaxBankMoney] call BIS_fnc_numberText,[MaxDonatorBankMoney] call BIS_fnc_numberText,CurrencyName], "PLAIN DOWN"];
    };
    } else {
        player setVariable["cashMoney",(_wealth - _amount),true];
        player setVariable["bankMoney",(_bank + _amount),true];
        cutText [format["You have deposited %1 %2", [_amount] call BIS_fnc_numberText, CurrencyName], "PLAIN DOWN"];
    };

    PVDZE_plr_Save = [player,(magazines player),true,true] ;
    publicVariableServer "PVDZE_plr_Save";
    PVDZE_bank_Save = [player];
    publicVariableServer "PVDZE_bank_Save";

};

GivePlayerAmount = {
    private ["_amount","_target","_wealth"];
    
    _amount = parseNumber (_this select 0);
    _target = cursorTarget;
    _wealth = player getVariable["cashMoney",0];
    _twealth = _target getVariable["cashMoney",0];
    _isMan = _target in playableUnits;

    if (_amount < 1 or _amount > _wealth) exitWith {
        cutText ["You can not give more than you currently have.", "PLAIN DOWN"];
    };

    if (!_isMan) exitWith {
        cutText ["You can only give money to a player", "PLAIN DOWN"];
    };

    player setVariable["cashMoney",_wealth - _amount, true];

    _target setVariable["cashMoney",_twealth + _amount, true];

    PVDZE_plr_Save = [player,(magazines player),true,true] ;
    publicVariableServer "PVDZE_plr_Save";
    PVDZE_plr_Save = [_target,(magazines _target),true,true] ;
    publicVariableServer "PVDZE_plr_Save";

    cutText [format["You gave %1 %2.", _amount, CurrencyName], "PLAIN DOWN"];
};

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

×
×
  • Create New...