Raised This Month: $51 Target: $400
 12% 

[L4D2] Survivors can draw guns while on a ladder


Post New Thread Reply   
 
Thread Tools Display Modes
theproperson
Member
Join Date: Feb 2017
Old 03-11-2018 , 06:50   Re: [L4D2] Survivors can draw guns while on a ladder
Reply With Quote #11

Sorry for the late reply but would like to report that version 1.2 works flawlessly and fixes the problem I addressed in my previous post. Have been able to shoot commons falling ontop of me while climbing without issue.
theproperson is offline
axelnieves2012
Senior Member
Join Date: Oct 2014
Location: Argentina
Old 03-11-2018 , 19:37   Re: [L4D2] Survivors can draw guns while on a ladder
Reply With Quote #12

nice plugin. Mode 3 would be nice too....
Mode 3 : Always draw weapons (just like counter strike)
axelnieves2012 is offline
Mel Ennial
Junior Member
Join Date: Feb 2018
Old 03-12-2018 , 08:38   Re: [L4D2] Survivors can draw guns while on a ladder
Reply With Quote #13

Quote:
Originally Posted by theproperson View Post
Sorry for the late reply but would like to report that version 1.2 works flawlessly and fixes the problem I addressed in my previous post. Have been able to shoot commons falling ontop of me while climbing without issue.
Great! Thanks for letting me know.

Quote:
Originally Posted by axelnieves2012 View Post
nice plugin. Mode 3 would be nice too....
Mode 3 : Always draw weapons (just like counter strike)
I'll see what I can do. The thing is, when you draw your guns, the plugin actually gives you temporary flight. The challenge for always-guns is going to be: how do I work out when we're at the top of the ladder, so we should disable flight?

Last edited by Mel Ennial; 03-12-2018 at 08:43.
Mel Ennial is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 03-12-2018 , 20:29   Re: [L4D2] Survivors can draw guns while on a ladder
Reply With Quote #14

Good plugin, ran into a possible bug and may have found the culprit...
I will check this myself however I believe when you are either punched by a tank or are hit by its projectile your movetype changes to MOVETYPE_FLY, it's either that or i'm using a plugin that changes MOVETYPE_FLY when hit by a tank, either way this can trigger MOVETYPE_LADDER while not on a ladder and cause your weapon to continuously deploy..

if (GetEntityMoveType(client) == MOVETYPE_FLY)
{
if (IsMoving(client))
{
//Survivor has moved! Change their movetype. We need to use MOVETYPE_LADDER on auto mode.
if (iMode == LG_MODE_MANUAL)
SetEntityMoveType(client, MOVETYPE_WALK);
else if (iMode == LG_MODE_AUTO)
SetEntityMoveType(client, MOVETYPE_LADDER);
}
return Plugin_Continue;
}

I looked at the code and suspect that this section needs a more solid check that the player is actually on a ladder or else when the players MOVETYPE does change to FLY it can trigger this. I was using auto mode btw...possibly check the netprops or datamaps for ladder vec direction or something to see if while MOVETYPE_FLY is set that the player is still on the ladder, I'm not sure it will work but other than detecting the Movetype Ladder i'm not sure how else to detect a player actually being on a ladder. I'll look into it though, like the plugin...good job Only other solid thing I can think of is detect the players distance from the ladder entity, may be the best option. Or just block the code when hit by a tank and your movetype changes for a few secs...

Last edited by MasterMind420; 03-12-2018 at 20:37.
MasterMind420 is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 03-13-2018 , 02:31   Re: [L4D2] Survivors can draw guns while on a ladder
Reply With Quote #15

Quote:
Originally Posted by MasterMind420 View Post
[...]
Confirmed. But fixed it anyway on my own:
PHP Code:
MoveType mtLastBit[MAXPLAYERS+1];
// ...
{
    
MoveType mtBit GetEntityMoveType(client);
    if (
mtBit == MOVETYPE_FLY)
    {
        if (
mtLastBit[client] != MOVETYPE_LADDER/* fix for tank punches and thrown rocks */
        
{
            return 
Plugin_Continue;
        }
        
// ...
    
}
    else if (
mtBit == MOVETYPE_LADDER)
    {
        
// ...
        
else if (iMode == LG_MODE_AUTO && !IsMoving(client))
        {
            if (
mtLastBit[client] == MOVETYPE_FLY/* fix for never-ending loop when auto mode. */
            
{
                return 
Plugin_Continue;
            }
            
// ...
        
}
    }
    
    
mtLastBit[client] = mtBit;
    return 
Plugin_Continue;


Last edited by cravenge; 03-13-2018 at 11:33. Reason: Tag mismatch fix...
cravenge is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 03-13-2018 , 02:38   Re: [L4D2] Survivors can draw guns while on a ladder
Reply With Quote #16

If your feeling ambitious when two human players touch on the ladder it also causes weapon redeploy, bots are unaffected by this. I was thinking of using sdkhook touch to prevent that...but if u get to messing with it before I do, cool...
MasterMind420 is offline
Mel Ennial
Junior Member
Join Date: Feb 2018
Old 03-13-2018 , 10:57   Re: [L4D2] Survivors can draw guns while on a ladder
Reply With Quote #17

Quote:
Originally Posted by cravenge View Post
Confirmed. But fixed it anyway on my own:
PHP Code:
int iLastMoveType[MAXPLAYERS+1];
// ...
{
    
int iMoveType GetEntityMoveType(client);
    if (
iMoveType == MOVETYPE_FLY)
    {
        if (
iLastMoveType[client] != MOVETYPE_LADDER/* fix for tank punches and thrown rocks */
        
{
            return 
Plugin_Continue;
        }
        
// ...
    
}
    else if (
iMoveType == MOVETYPE_LADDER)
    {
        
// ...
        
else if (iMode == LG_MODE_AUTO && !IsMoving(client))
        {
            if (
iLastMoveType[client] == MOVETYPE_FLY/* fix for never-ending loop when auto mode. */
            
{
                return 
Plugin_Continue;
            }
            
// ...
        
}
    }
    
    
iLastMoveType[client] = iMoveType;
    return 
Plugin_Continue;

Awesome. I've put this in the plugin with one difference: my compiler refuses to let me store GetEntityMoveType as an int. new iMoveType = GetEntityMoveType(client); throws a tag mismatch error. On the other hand, PrintToChatAll("movetype = %d", GetEntityMoveType(client)); compiles and works for me as expected. I'm obviously missing something fundamental here, so in the meantime I've put in a kludge that converts the result of GetEntityMoveType - whatever that is (a handle?) - to an int. The Sourcemod API says GetEntityMoveType returns a MoveType, but entity_prop_stocks suggests that the MoveTypes are ints.

I'll have a look at using a touch hook, MasterMind420, but I've got to admit I haven't had much luck with that in the past. My original approach to the ladder-gun problem was to try and use the various touch hooks to detect when a ladder and a player touched, but it was unreliable. Maybe I'll have more luck with player-player interaction. Here goes nothing!

Last edited by Mel Ennial; 03-13-2018 at 11:00.
Mel Ennial is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 03-13-2018 , 11:35   Re: [L4D2] Survivors can draw guns while on a ladder
Reply With Quote #18

Quote:
Originally Posted by Mel Ennial View Post
[...]
So that's what the compiler was telling me about. Snippet fixed.

Last edited by cravenge; 03-13-2018 at 11:35.
cravenge is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 03-13-2018 , 12:07   Re: [L4D2] Survivors can draw guns while on a ladder
Reply With Quote #19

Hmm i keep losing power today so i cant really mess around with this, but maybe instead of using onplayerruncmd how about doing this in prethink? Also i haven't really messed around with sdkhook touch so im not sure if it would work..maybe theres a datamap or netprop or input/output that can be used to detect players touching. also i wanted to see if this is effected by the cvar that allows u to enable/disable pushing against other players as well...just a few thoughts.

Last edited by MasterMind420; 03-13-2018 at 12:08.
MasterMind420 is offline
chatyak
Senior Member
Join Date: Aug 2011
Old 03-20-2018 , 19:00   Re: [L4D2] Survivors can draw guns while on a ladder
Reply With Quote #20

Can you add the option for secondary weapon only (pistol) ?
chatyak is offline
Reply



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 23:30.


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