How do i disable TAC Tank damage towards infantries, in SafeWriting?

  • RengHub

    I use SSM Safewriting 291.
    How do i disable TAC Tank damage towards infantries?

    0
  • RengHub

    Another quick question. When a user leaves his vehicle, or he crashes his vehicle and it explodes, he becomes invulnerable for a very short amount of duration, so he doesn't die (even if he should). How to remove that invulnerability too? I'd really appreciate if you guys help about these two questions, please.

    0
  • GamerGirI

    This disables TAC vs. Infantry
    --------------------------------
    function BlockTACDamage(hit)
    	hit.damage = ((hit.target and hit.shooter and hit.target ~= hit.shooter and not hit.target.actor:GetLinkedVehicleId() and hit.type == "tac") and 0 or hit.damage);
    end;
    SafeWriting.FuncContainer:AddFunc(BlockTACDamage,"ProcessActorDamage");

    --------------------------------
    And about the invulerability after leaving vehicle.. I didn't manage to find that Script in SFW, but maybe it can be disabled in the config file?

    1
  • GamerGirI

    Is case you want to reduce the damage, replace the "0" with "hit.damage * [Damage Multiplier]".

    0
  • GamerGirI

    Ok, after some research I found the code.
    Replace the original function with this or just add a new Plugin
    ------------------------------
    _InvulnerabilityWhenLeaveVehicle = false; -- set to true if you WANT Invulnerability after leaving vehicle
    g_gameRules.OnLeaveVehicleSeat=function(self,vehicle, seat, entityId, exiting)
    	MakePluginEvent("OnLeaveVehicleSeat",vehicle,seat,entityId,exiting);
    	if (self.isServer and self:GetState()=="InGame") then
    		if (exiting) then
    			local empty=true;
    			for i,seat in pairs(vehicle.Seats) do
    				local passengerId = seat:GetPassengerId();
    				if (passengerId and passengerId~=NULL_ENTITY and passengerId~=entityId) then
    					empty=false;
    					break;
    				end
    			end
    			if (empty) then
    				vehicle.lastOwnerId=entityId;
    				local player=System.GetEntity(entityId);
    				if (player) then
    					player.lastVehicleId=vehicle.id;
    				end
    			end
    			if(entityId==vehicle.vehicle:GetOwnerId()) then
    				vehicle.vehicle:SetOwnerId(NULL_ENTITY);
    			end	
    			if vehicle.class=="US_vtol" or vehicle.class=="Asian_helicopter" and _InvulnerabilityWhenLeaveVehicle then
    				g_gameRules.game:SetInvulnerability(entityId,true,(vehicle.vehicle:GetMovementType()=="air" and 2 or 1));
    			end
    		end
    	end
    end

    ------------------------------
    Hope this helped you! :D

    1
  • RengHub

    Hey! First of all, thanks for all the effort!

    I copied that "TAC vs Infantry" code to inside of the AdditionalScripts.lua and i run the server. However i was super invincible. After that code, even the Forbidden Areas couldn't kill me, and the players. Nobody was taking damage.

    I also couldn't manage to make the "invulnerability after leaving aircraft" code work. I copied it to the SafeWritingGameRules.lua.
    It is supposed to be copied in there, isn't it? Correct me if i'm mistaken. Thanks for all the effort again!

    0
  • GamerGirI

    Strange, I tested the Anti TAC on my Server and it worked properly o.O
    About the "invulnerability after leaving aircraft" code, you have to replace the original "g_gameRules.OnLeaveVehicleSeat" function or at least copy the new one after the original function

    0
  • GamerGirI

    I again just tested the Anti TAC script and it works properly in my Server
    Try replacing

    SafeWriting.FuncContainer:AddFunc(BlockTACDamage,"ProcessActorDamage");


    with

    SafeWriting.FuncContainer:AddFunc(BlockTACDamage,"OnHit");


    1
  • RengHub

    Still doesn't work properly. TAC vs Infantry code makes everyone invincible. Normal guns, base turrets, forbidden areas, power punches, grenades, high falls... nothing deals damage to players while that code is active. The players turning into something like god mode. Everything deals 0 damage if that code is active.

    Also, even if i replace that "LeaveOnVehicleSeat" code with the original one, or replace it after the original function, it still doesn't work. Player still becomes invulnerable for 1 seconds after leaving aircrafts.

    Really strange things.

    0