Raised This Month: $319 Target: $400
 79%   Almost there!

(CS) Shooting under water


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ricky
Senior Member
Join Date: Jul 2005
Old 09-20-2017 , 16:05   (CS) Shooting under water
Reply With Quote #1

Anyone else have issues with shooting the galil, famas, and both shotguns underwater? These guns are all jammed underwater for me.
Ricky is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-20-2017 , 16:57   Re: (CS) Shooting under water
Reply With Quote #2

As far as I know that's how it's supposed to work.
klippy is offline
Ricky
Senior Member
Join Date: Jul 2005
Old 09-20-2017 , 17:32   Re: (CS) Shooting under water
Reply With Quote #3

It doesn't make much sense especially with the galil. Can anyone write up a simple script to override the restrictions?

Last edited by Ricky; 09-20-2017 at 17:33.
Ricky is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Location: Tunisia
Old 09-20-2017 , 19:02   Re: (CS) Shooting under water
Reply With Quote #4

for galil, untested :
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

const XO_CBASEPLAYERWEAPON 4
const XO_CBASEPLAYER 5
const XO_PLAYER 41

enum
{
    
WATERLEVEL_NOT,
    
WATERLEVEL_FEET,
    
WATERLEVEL_WAIST,
    
WATERLEVEL_HEAD
};

public 
plugin_init()
{
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_galil""Weapon_PrimaryAttack_Pre")
}

public 
Weapon_PrimaryAttack_Pre(ent)
{
    new 
id get_pdata_cbase(entXO_PLAYERXO_CBASEPLAYERWEAPON)
    
    new 
waterlevel pev(idpev_waterlevel)
    
    if(
waterlevel == WATERLEVEL_HEAD)
    {
        
set_pev(id,pev_waterlevel,WATERLEVEL_WAIST)
    }

__________________
JusTGo is offline
Ricky
Senior Member
Join Date: Jul 2005
Old 09-20-2017 , 19:44   Re: (CS) Shooting under water
Reply With Quote #5

Quote:
Originally Posted by JusTGo View Post
for galil, untested :
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

const XO_CBASEPLAYERWEAPON 4
const XO_CBASEPLAYER 5
const XO_PLAYER 41

enum
{
    
WATERLEVEL_NOT,
    
WATERLEVEL_FEET,
    
WATERLEVEL_WAIST,
    
WATERLEVEL_HEAD
};

public 
plugin_init()
{
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_galil""Weapon_PrimaryAttack_Pre")
}

public 
Weapon_PrimaryAttack_Pre(ent)
{
    new 
id get_pdata_cbase(entXO_PLAYERXO_CBASEPLAYERWEAPON)
    
    new 
waterlevel pev(idpev_waterlevel)
    
    if(
waterlevel == WATERLEVEL_HEAD)
    {
        
set_pev(id,pev_waterlevel,WATERLEVEL_WAIST)
    }

It works except the gunshots are silent. Can't hear the bullet sounds of the galil. If you can fix that part and add a string for the other 3 weapons, this would make a good fix for this bug. After retesting your latest nade version plugin, I haven't had any issues so far. Thanks!
Ricky is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 09-20-2017 , 21:02   Re: (CS) Shooting under water
Reply With Quote #6

it's not a bug, that's how the game has always been
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
[email protected]
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 09-20-2017 , 21:25   Re: (CS) Shooting under water
Reply With Quote #7

Code:
#include <amxmodx> #include <engine> #include <fakemeta> #include <hamsandwich> const m_pPlayer = 41; const m_pPlayer_osdiff = 4; new g_oldWaterLevel; new bool:g_isFiringUnderwater; public plugin_init() {     register_plugin("Shoot underwater enabler", "1.0", "PRoSToC0der");         static const weaponClassnames[][] = {         "weapon_galil",         "weapon_famas",         "weapon_xm1014",         "weapon_m3"     };         for (new i = 0; i < sizeof(weaponClassnames); ++i) {         RegisterHam(Ham_Weapon_PrimaryAttack, weaponClassnames[i], "WeaponFiring", .Post = false);         RegisterHam(Ham_Weapon_PrimaryAttack, weaponClassnames[i], "WeaponFired", .Post = true);     }     RegisterHam(Ham_Item_PostFrame, "weapon_famas", "WeaponFiring", .Post = false);     RegisterHam(Ham_Item_PostFrame, "weapon_famas", "WeaponFired", .Post = true);         register_forward(FM_PlaybackEvent, "PlaybackingEvent", ._post = false); } public PlaybackingEvent(flags, invoker, eventIndex, Float:delay, Float:origin[3], Float:angles[3],     Float:floatParam1, Float:floatParam2, integerParam1, integerParam2, bool:booleanParam1, bool:booleanParam2) {     if (!g_isFiringUnderwater) {         return FMRES_IGNORED;     }         playback_event(flags & ~FEV_NOTHOST, invoker, eventIndex, delay, origin, angles,         floatParam1, floatParam2, integerParam1, integerParam2, booleanParam1, booleanParam2);     return FMRES_SUPERCEDE; } public WeaponFiring(weapon) {     new owner = get_pdata_cbase(weapon, m_pPlayer, m_pPlayer_osdiff);     new waterLevel = pev(owner, pev_waterlevel);     if (waterLevel == 3) {         g_oldWaterLevel = waterLevel;         set_pev(owner, pev_waterlevel, 0);                 g_isFiringUnderwater = true;     } } public WeaponFired(weapon) {     if (g_isFiringUnderwater) {         g_isFiringUnderwater = false;                 new owner = get_pdata_cbase(weapon, m_pPlayer, m_pPlayer_osdiff);         set_pev(owner, pev_waterlevel, g_oldWaterLevel);     } }
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
Ricky
Senior Member
Join Date: Jul 2005
Old 09-21-2017 , 02:00   Re: (CS) Shooting under water
Reply With Quote #8

Quote:
Originally Posted by [email protected] View Post
Code:
#include <amxmodx> #include <engine> #include <fakemeta> #include <hamsandwich> const m_pPlayer = 41; const m_pPlayer_osdiff = 4; new g_oldWaterLevel; new bool:g_isFiringUnderwater; public plugin_init() {     register_plugin("Shoot underwater enabler", "1.0", "PRoSToC0der");         static const weaponClassnames[][] = {         "weapon_galil",         "weapon_famas",         "weapon_xm1014",         "weapon_m3"     };         for (new i = 0; i < sizeof(weaponClassnames); ++i) {         RegisterHam(Ham_Weapon_PrimaryAttack, weaponClassnames[i], "WeaponFiring", .Post = false);         RegisterHam(Ham_Weapon_PrimaryAttack, weaponClassnames[i], "WeaponFired", .Post = true);     }     RegisterHam(Ham_Item_PostFrame, "weapon_famas", "WeaponFiring", .Post = false);     RegisterHam(Ham_Item_PostFrame, "weapon_famas", "WeaponFired", .Post = true);         register_forward(FM_PlaybackEvent, "PlaybackingEvent", ._post = false); } public PlaybackingEvent(flags, invoker, eventIndex, Float:delay, Float:origin[3], Float:angles[3],     Float:floatParam1, Float:floatParam2, integerParam1, integerParam2, bool:booleanParam1, bool:booleanParam2) {     if (!g_isFiringUnderwater) {         return FMRES_IGNORED;     }         playback_event(flags & ~FEV_NOTHOST, invoker, eventIndex, delay, origin, angles,         floatParam1, floatParam2, integerParam1, integerParam2, booleanParam1, booleanParam2);     return FMRES_SUPERCEDE; } public WeaponFiring(weapon) {     new owner = get_pdata_cbase(weapon, m_pPlayer, m_pPlayer_osdiff);     new waterLevel = pev(owner, pev_waterlevel);     if (waterLevel == 3) {         g_oldWaterLevel = waterLevel;         set_pev(owner, pev_waterlevel, 0);                 g_isFiringUnderwater = true;     } } public WeaponFired(weapon) {     if (g_isFiringUnderwater) {         g_isFiringUnderwater = false;                 new owner = get_pdata_cbase(weapon, m_pPlayer, m_pPlayer_osdiff);         set_pev(owner, pev_waterlevel, g_oldWaterLevel);     } }
Works fine so far and I'll report back if any issues. Thanks! I don't know if the restrictions were intended but it still makes no sense and considered a bug to me. Maybe when putting out 1.6, valve had edited shotgun mechanics and forgot to tweak these 4 weapons underwater.

Last edited by Ricky; 09-21-2017 at 03:12.
Ricky is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 09-22-2017 , 13:18   Re: (CS) Shooting under water
Reply With Quote #9

Quote:
Originally Posted by Ricky View Post
Works fine so far and I'll report back if any issues. Thanks! I don't know if the restrictions were intended but it still makes no sense and considered a bug to me. Maybe when putting out 1.6, valve had edited shotgun mechanics and forgot to tweak these 4 weapons underwater.
adding a check if player is underwater to prevent it from shooting doesnt seem like a bug to me
__________________
I accept private plugin requests.
DjSoftero is offline
voed
Junior Member
Join Date: Aug 2017
Location: Ukraine
Old 09-22-2017 , 18:25   Re: (CS) Shooting under water
Reply With Quote #10

Quote:
Originally Posted by Ricky View Post
Works fine so far and I'll report back if any issues. Thanks! I don't know if the restrictions were intended but it still makes no sense and considered a bug to me. Maybe when putting out 1.6, valve had edited shotgun mechanics and forgot to tweak these 4 weapons underwater.
https://github.com/s1lentq/ReGameDLL...wpn_m3.cpp#L60
Looks like it was a feature, not bug
voed is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:45.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode