Raised This Month: $23 Target: $400
 5% 

[L4D & L4D2] Tank Rock Lag Compensation


Post New Thread Reply   
 
Thread Tools Display Modes
larrybrains
Member
Join Date: May 2017
Old 12-27-2019 , 16:34   Re: [L4D & L4D2] Tank Rock Lag Compensation
Reply With Quote #11

This plugin seems to cause issues with the hunting rifle being able to hit tank rocks.

When the plugin is enabled, nobody on my server can destroy tank rocks with the hunting rifle. If I disable this plugin, the issue goes away.

EDIT: I think I found a fix:

For "IsRifle", needed to add a line for "hunting_rifle"

PHP Code:
public bool IsRifle(const char[] weaponName)
{
    return 
StrEqual(weaponName"rifle")
        || 
StrEqual(weaponName"rifle_ak47")
        || 
StrEqual(weaponName"rifle_desert")
        || 
StrEqual(weaponName"rifle_m60")
        || 
StrEqual(weaponName"rifle_sg552")
        || 
StrEqual(weaponName"hunting_rifle");

EDIT 2: Actually, it might fit better under IsSniper, but works either way.

Last edited by larrybrains; 12-27-2019 at 17:11. Reason: A note
larrybrains is offline
fbef0102
Senior Member
Join Date: Sep 2017
Location: TW
Old 12-28-2019 , 08:18   Re: [L4D & L4D2] Tank Rock Lag Compensation
Reply With Quote #12

Quote:
Originally Posted by larrybrains View Post
This plugin seems to cause issues with the hunting rifle being able to hit tank rocks.

Oh, never noticed that before,thanks
I modify code and test
if StrEqual(weaponName, "hunting_rifle") under IsRifle(),
hunting rifle needs 3~4 shots to break tank

if under IsSniper(), only need 1 shot
__________________

Last edited by fbef0102; 12-28-2019 at 08:19.
fbef0102 is offline
Silvers
AlliedModders Donor
Join Date: Aug 2010
Location: SpaceX
Old 03-04-2020 , 21:41   Re: [L4D & L4D2] Tank Rock Lag Compensation
Reply With Quote #13

This plugin conflicts with the Anomaly plugin and causes the errors below to spam the error log. Please could you add in the following to fix?

Code:
L 03/05/2020 - 02:20:04: [SM] Exception reported: Entity -1 (-2019573042) is invalid
L 03/05/2020 - 02:20:04: [SM] Blaming: l4d_rock_lagcomp.smx
L 03/05/2020 - 02:20:04: [SM] Call stack trace:
L 03/05/2020 - 02:20:04: [SM]   [0] GetEntPropVector
L 03/05/2020 - 02:20:04: [SM]   [1] Line 230, l4d_rock_lagcomp.sp::OnGameFrame
You're storing EntIndexToEntRef but never verify it on retrieval. Remove invalid rocks from the array, line 230 add:
PHP Code:
if( !rockEntity || EntRefToEntIndex(rockEntity) == INVALID_ENT_REFERENCE )
{
    
Array_RemoveRock(rockEntitiesArrayrockEntity);
    continue;

To avoid a further conflict where this plugin makes the Anomaly rock visible I would suggest checking the "m_iHammerID". It would be most efficient to do:

PHP Code:
// Add this line before "Array_AddNewRock" in "OnEntityCreated"
SDKHook(entityRefSDKHook_SpawnPostSpawnPost);

// Add this below outside "OnEntityCreated" function.
void SpawnPost(int entity)
{
    if( 
GetEntProp(entityProp_Data"m_iHammerID") == 92950 )
    {
        
Array_RemoveRock(rockEntitiesArrayEntIndexToEntRef(entity));
    }

That way the rock is removed from the array and saving many CPU cycles from the OnGameFrame function.

I would have made Anomaly compatible with this plugin but it's not possible on my end and the fix has to come from this plugin.

Thank you.


Edit: Since author is probably inactive, I've attached the plugin. Requires SMLib to compile so I've attached the compile version too.
Attached Files
File Type: smx l4d_rock_lagcomp.smx (13.3 KB, 44 views)
File Type: sp Get Plugin or Get Source (l4d_rock_lagcomp.sp - 51 views - 19.4 KB)
__________________

Last edited by Silvers; 03-05-2020 at 14:04.
Silvers is offline
fbef0102
Senior Member
Join Date: Sep 2017
Location: TW
Old 03-29-2020 , 13:39   Re: [L4D & L4D2] Tank Rock Lag Compensation
Reply With Quote #14

I found one more issue with this plugin
mounted machine gun being unable to hit tank rocks

I guess the author missed this weapon name
PHP Code:
weaponName"prop_mounted_machine_gun" 
Edit:
-fixed two missing weapon names "hunting_rifle" and "prop_mounted_machine_gun"
-add some codes from Silvers
Attached Files
File Type: smx l4d_rock_lagcomp.smx (21.0 KB, 31 views)
File Type: sp Get Plugin or Get Source (l4d_rock_lagcomp.sp - 42 views - 20.4 KB)
__________________

Last edited by fbef0102; 03-29-2020 at 13:58.
fbef0102 is offline
larrybrains
Member
Join Date: May 2017
Old 03-29-2020 , 14:13   Re: [L4D & L4D2] Tank Rock Lag Compensation
Reply With Quote #15

Quote:
Originally Posted by fbef0102 View Post
I found one more issue with this plugin
mounted machine gun being unable to hit tank rocks

I guess the author missed this weapon name
PHP Code:
weaponName"prop_mounted_machine_gun" 
Edit:
-fixed two missing weapon names "hunting_rifle" and "prop_mounted_machine_gun"
-add some codes from Silvers
When I try to compile this, I get some warnings on some of the new lines related to the mounted machine gun:

PHP Code:
l4d_rock_lagcomp.sp(166) : warning 213tag mismatch
l4d_rock_lagcomp
.sp(178) : warning 213tag mismatch
l4d_rock_lagcomp
.sp(459) : warning 213tag mismatch
l4d_rock_lagcomp
.sp(460) : warning 213tag mismatch 
larrybrains is offline
kmah
Junior Member
Join Date: Oct 2019
Old 08-01-2020 , 10:23   Re: [L4D & L4D2] Tank Rock Lag Compensation
Reply With Quote #16

Quote:
Originally Posted by larrybrains View Post
This plugin seems to cause issues with the hunting rifle being able to hit tank rocks.

When the plugin is enabled, nobody on my server can destroy tank rocks with the hunting rifle. If I disable this plugin, the issue goes away.

EDIT: I think I found a fix:

For "IsRifle", needed to add a line for "hunting_rifle"

PHP Code:
public bool IsRifle(const char[] weaponName)
{
    return 
StrEqual(weaponName"rifle")
        || 
StrEqual(weaponName"rifle_ak47")
        || 
StrEqual(weaponName"rifle_desert")
        || 
StrEqual(weaponName"rifle_m60")
        || 
StrEqual(weaponName"rifle_sg552")
        || 
StrEqual(weaponName"hunting_rifle");

EDIT 2: Actually, it might fit better under IsSniper, but works either way.

man many thanks i was looking for that for age, thanks bunch dude you save my life
kmah is offline
kmah
Junior Member
Join Date: Oct 2019
Old 08-01-2020 , 10:48   Re: [L4D & L4D2] Tank Rock Lag Compensation
Reply With Quote #17

Quote:
Originally Posted by fbef0102 View Post
Oh, never noticed that before,thanks
I modify code and test
if StrEqual(weaponName, "hunting_rifle") under IsRifle(),
hunting rifle needs 3~4 shots to break tank

if under IsSniper(), only need 1 shot
thank you for the additional information
kmah 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 16:27.


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