Five Elite Mercenaries are send to an Island in middle of the 1980'. The Task: Find and Eliminate a local Drug Baron. Features: new Physic, real Sunmovement, Day/Night Change, Hunger/Food system, realistic (!) Weather system, Light/Dark viewing system for AI, 5 different Fractions on the Island. Complete Realistic simulation of nearly all things, including Sleep. New weapons, new Vehicles. Vehicles driving system is now exact (!) like GTA IV , FireSystem,... this mod is Heavily inspired by GTA, IGI, FarCry.

Forum Thread
  Posts  
MP underwatershooting cause no longer Crash like in Vanilla FC (Games : Far Cry : Mods : FarCry Operation Clearing : Forum : Technical Discussion for OP CL Devkit : MP underwatershooting cause no longer Crash like in Vanilla FC) Locked
Thread Options
pvcf
pvcf Germany
Jan 6 2014 Anchor

in standart FarCry in MultiPlayer there is a Server Crash if a player shoots under water.

in Devkit there is a generally protection and a shoot_underwater flag.
however, to fix this problem on standart farcry server, try this:

search in BasicWeapon.lua the function

function BasicWeapon.Server:OnFire( params )

local retval;
local wi;
local ammo;
local shooter = params.shooter;
local stats = shooter.cnt;
local ammo_left;


after you have found this part, insert that :

function BasicWeapon.Server:OnFire( params )

local retval;
local wi;
local ammo;
local shooter = params.shooter;
local stats = shooter.cnt;
local ammo_left;

--pvcf under water shooting protection-------------

if (shooter.cnt:IsSwimming() and shooter.fireparams.fire_mode_type ~= FireMode_Melee then
return;
end 

--pvcf under water shooting protection-------------

this was serverside, now for clients:

search in BasicWeapon.lua the function

function BasicWeapon.Client:OnFire( Params )

	local basic_weapon=BasicWeapon;
	local my_player=_localplayer;
	local shooter=Params.shooter;
	local sound=Sound;
	local cur_time=_time;
	local ReturnVal = nil;
	local FireModeNum;
	local WeaponStateData = shooter.weapon_info;
	local CurFireParams;
	local stats = shooter.cnt;
	local scope=ClientStuff.vlayers:IsActive("WeaponScope");


and add below this the same line like above:

function BasicWeapon.Client:OnFire( Params )

	local basic_weapon=BasicWeapon;
	local my_player=_localplayer;
	local shooter=Params.shooter;
	local sound=Sound;
	local cur_time=_time;
	local ReturnVal = nil;
	local FireModeNum;
	local WeaponStateData = shooter.weapon_info;
	local CurFireParams;
	local stats = shooter.cnt;
	local scope=ClientStuff.vlayers:IsActive("WeaponScope");

--pvcf under water shooting protection-------------

if (shooter.cnt:IsSwimming() and shooter.fireparams.fire_mode_type ~= FireMode_Melee then
return;
end 

--pvcf under water shooting protection-------------

Edited by: pvcf

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.