Raised This Month: $ Target: $400
 0% 

PlayerRunCmdHook crash


Post New Thread Reply   
 
Thread Tools Display Modes
ElectricStalin
Member
Join Date: Apr 2017
Old 10-12-2017 , 14:40   Re: PlayerRunCmdHook crash
Reply With Quote #11

Quote:
Originally Posted by Bacardi View Post
(Not sure what you mean about key button "1", server not regognice keyboard buttons.)
Under the button "1" I mean the choice of the primary weapon. (1-primary, 2-secondary, 3- knife and so forth).

Do you think it's more reliable to handle button pressing than to catch the weapon slot selection event?
ElectricStalin is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-13-2017 , 03:33   Re: PlayerRunCmdHook crash
Reply With Quote #12

Quote:
Originally Posted by ElectricStalin View Post
Under the button "1" I mean the choice of the primary weapon. (1-primary, 2-secondary, 3- knife and so forth).

Do you think it's more reliable to handle button pressing than to catch the weapon slot selection event?
unfortunally client side commands slot1, slot2 etc. etc. not work on server.

It depends how complicated your backbag system goes, you maybe end with combine both methods...
Then there is SDKHooks types to get weapon equip, switch, drop action.
__________________
Do not Private Message @me
Bacardi is offline
Battleweaver
New Member
Join Date: Jul 2017
Old 10-13-2017 , 05:41   Re: PlayerRunCmdHook crash
Reply With Quote #13

Greetings.
As a participant in ElectricStalin's project, i would like to share some new data.
Due to lack of instruments in SourcePawn for creating proper inventory (classes, string input/output for functions), we spawn entities of weapons, then keep those entities out of player's sight somewhere on the map. Since we use Valve maps (verifeid workshop maps too, the point is: "non-custom") we rejected the idea to create container on map for weapon entities.

Slowly getting to the point.
During weapon swap we teleport weapon entities between buffer point and client's hands. In some cases a duped weapon entity flies through map from buffer point to player in addition to teleporting. Not every map object cen stop such ghost weapon.

Futhermore, if other player catches such bird and then tries to use it at the same time the weapon's owner uses the real copy of the weapon, this crushes server at "OnPlayerRunCmd".
Battleweaver is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-13-2017 , 06:04   Re: PlayerRunCmdHook crash
Reply With Quote #14

Ok, good, you have found problem.

In csgo, there is one parameter in weapons what prevent pickup
PHP Code:
SetEntProp(weaponProp_Data"m_bCanBePickedUp"0); 


*edit
I made one sample... not perfect tough. Csgo

This handle only primary and secondary weapons.
-To store weapon in backbag, swap weapon from ground ("E" button - use)
- you may see flash of dropping weapon on ground , but it should be invisible after 5 sec.
- After collecting weapons with swap method, use "TAB" button - score
this change your weapon from backbag. You may hear dropping weapon and falsh of it, but it still in your backbag.

- These weapons stored in backbag, are actually hidden with command "DisableDraw" and disabled for pickup by players "m_bCanBePickedUp"

- free to try

Spoiler
__________________
Do not Private Message @me

Last edited by Bacardi; 10-13-2017 at 08:09.
Bacardi is offline
blaacky
Senior Member
Join Date: Oct 2012
Old 10-14-2017 , 12:48   Re: PlayerRunCmdHook crash
Reply With Quote #15

what game is it for?
__________________
blaacky is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 10-31-2017 , 02:00   Re: PlayerRunCmdHook crash
Reply With Quote #16

Quote:
Originally Posted by ElectricStalin View Post
Yes) Player can carry many weapons. In clientsWeapon[][] i store indexes. And player can scroll weapons by pressing "1".
what your doing won't work, u have to detect the last weapon in a given slot that your in, within onplayerruncmd when it detects a change in what u last selected, give the next weapon in your array to the player, this will allow u too press the 1 key to cycle the weapons you have. I do this in my l4d2 primaries plugin.

Last edited by MasterMind420; 10-31-2017 at 20:14.
MasterMind420 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 10-31-2017 , 08:31   Re: PlayerRunCmdHook crash
Reply With Quote #17

Your crash in game code far away from OnPlayerRunCmd, I doubt it is even related.

You can't just latch onto the first thing that you recognise, especially when it is just a hook stub.

Frames are exponentially less relevant the further they are from the top of the stack.


EDIT: The fatal error that caused the crash is "CLagCompensationManager::StartLagCompensatio n with NULL CUserCmd!!!"

Whch is a classic one and the SDK actually has a comment blaming what you're doing:
Code:
// This can hit if m_hActiveWeapon incorrectly gets set to a weapon not actually owned by the local player 
// (since lag comp asks for the GetPlayerOwner() which will have m_pCurrentCommand == NULL, 
//  not the player currently executing a CUserCmd).
https://github.com/alliedmodders/hl2....cpp#L249-L252
__________________

Last edited by asherkin; 10-31-2017 at 08:35.
asherkin 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 22:35.


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