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

Crash with CS_OnCSWeaponDrop


Post New Thread Reply   
 
Thread Tools Display Modes
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-09-2021 , 18:22   Re: CS_OnCSWeaponDrop not work?
Reply With Quote #11

I made issue in github
[Crash] [CS:S] CS_OnCSWeaponDrop with lot of bots (at least)

Really annoying crash. Last test was 32 bots with only knives did not crash server... have to test again later. Takes so long to confirm.
Bacardi is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 02-10-2021 , 11:23   Re: Crash with CS_OnCSWeaponDrop
Reply With Quote #12

I've moved the posts here to a new thread - please do not hijack other people's threads, especially not ones from 6 years ago. It makes it hard to follow your problem and confuses people coming to the thread.

Bacardi, your issues with Accelerator are caused by a Windows update from December breaking breakpad - unfortunately your crash reports aren't going to be useful here.

Is there any chance of an Accelerator report from a Linux server? CS:S still has symbols there so it would be a big help (especially with the crash being time consuming to reproduce).
__________________
asherkin is offline
_EverGreen_
Junior Member
Join Date: Feb 2021
Old 02-10-2021 , 13:02   Re: Crash with CS_OnCSWeaponDrop
Reply With Quote #13

Quote:
Originally Posted by asherkin View Post
I've moved the posts here to a new thread - please do not hijack other people's threads, especially not ones from 6 years ago. It makes it hard to follow your problem and confuses people coming to the thread.

Bacardi, your issues with Accelerator are caused by a Windows update from December breaking breakpad - unfortunately your crash reports aren't going to be useful here.

Is there any chance of an Accelerator report from a Linux server? CS:S still has symbols there so it would be a big help (especially with the crash being time consuming to reproduce).
Hi, What update? i have windows 10 build 1803, if accelerator work on this windows build, explain me how to install and i post results.

Thanks!
_EverGreen_ is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-12-2021 , 08:27   Re: Crash with CS_OnCSWeaponDrop
Reply With Quote #14

I have setup virtualbox, running Linux Manjaro.
Installed Cs:s SRCDS with stable version of MM:s and SM and loaded test plugin.

30 Bots have play over 50 rounds and still goes, without crash.

:/

Something fishy with OS Windows version. Does bot do something different than on Linux ?
Or signature little bit off... ?


*edit
Does this sound like stupid explanation...
In windows, function work like
Code:
6A 01                                         push    1               ; char
6A 01                                         push    1               ; char
8B 45 EC                                      mov     eax, [ebp+var_14]
50                                            push    eax             ; void **
8B 4D F8                                      mov     ecx, [ebp+var_8]
E8 B6 F0 FF FF                                call    sub_10270B60
But in Linux
Code:
mov     dword ptr [esp+0Ch], 1 ; bool
mov     dword ptr [esp+8], 0 ; bool
mov     [esp+4], eax    ; lpsrc
mov     [esp], edi      ; this
call    _ZN9CCSPlayer12CSWeaponDropEP17CBaseCombatWeaponbb ; CCSPlayer::CSWeaponDrop(CBaseCombatWeapon *,bool,bool)

Last edited by Bacardi; 02-12-2021 at 09:45.
Bacardi is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-12-2021 , 11:15   Re: Crash with CS_OnCSWeaponDrop
Reply With Quote #15

*edit
Have you thinking to use Events ?
Code:
	"bomb_dropped"
	{
		"userid"	"short"		// player who dropped the bomb
	}

	"bomb_pickup"
	{
		"userid"	"short"		// player who picked up the bomb
	}

	"item_pickup"
	{
		"userid"	"short"
		"item"		"string"	// either a weapon such as 'tmp' or 'hegrenade', or an item such as 'nvgs'
	}





ok... I tried something with DHooks
https://forums.alliedmods.net/showpo...&postcount=589


This example block C4 drop.
And C4 will disappear when player die... because this happen before player death.
*edit
of course, this can be fix by hooking second function "void CCSPlayer::DropWeapons( bool fromDeath, bool friendlyFire )" and check will player drop weapons on death.



I'm not 100% sure I did right way and not sure do this crash server as well :P


*edit
Windows ONLY
Attached Files
File Type: zip css_dhooks_weapondrop.zip (6.8 KB, 13 views)
__________________
Do not Private Message @me

Last edited by Bacardi; 02-12-2021 at 11:57.
Bacardi is offline
Vit_amin
Senior Member
Join Date: Dec 2015
Location: Russian Federation
Old 02-12-2021 , 15:43   Re: Crash with CS_OnCSWeaponDrop
Reply With Quote #16

You have this on Linux ?
Vit_amin is offline
_EverGreen_
Junior Member
Join Date: Feb 2021
Old 02-12-2021 , 15:46   Re: Crash with CS_OnCSWeaponDrop
Reply With Quote #17

Quote:
Originally Posted by Bacardi View Post
I have setup virtualbox, running Linux Manjaro.
Installed Cs:s SRCDS with stable version of MM:s and SM and loaded test plugin.

30 Bots have play over 50 rounds and still goes, without crash.

:/

Something fishy with OS Windows version. Does bot do something different than on Linux ?
Or signature little bit off... ?


*edit
Does this sound like stupid explanation...
In windows, function work like
Code:
6A 01                                         push    1               ; char
6A 01                                         push    1               ; char
8B 45 EC                                      mov     eax, [ebp+var_14]
50                                            push    eax             ; void **
8B 4D F8                                      mov     ecx, [ebp+var_8]
E8 B6 F0 FF FF                                call    sub_10270B60
But in Linux
Code:
mov     dword ptr [esp+0Ch], 1 ; bool
mov     dword ptr [esp+8], 0 ; bool
mov     [esp+4], eax    ; lpsrc
mov     [esp], edi      ; this
call    _ZN9CCSPlayer12CSWeaponDropEP17CBaseCombatWeaponbb ; CCSPlayer::CSWeaponDrop(CBaseCombatWeapon *,bool,bool)
Hi Bacardi!

You loaded $2000$ map on server commandline?

my configuration is:

SRCDS:
".\srcds.exe" -game cstrike -console +map $2000$ -maxplayers 32 +ip xxx -ip xxx -port 27150 -nohltv

where xxx is the local machine IP with access to INET.

^-- with this, crash is immediatly. ONLY CRASH immediatly on $2000$ MAP or maps with dropped weapons on RoundStart, NOT CRASH ON DE_DUST2 map or any map with BOMBSITE

---------------------------------------------------

server.cfg:

sv_lan 0
sv_pure 1
mp_autokick 0

mp_freezetime 0
mp_forcecamera 0
mp_timelimit 30 // 30
mp_match_end_at_timelimit 1
mp_roundtime 5 // 3
net_maxfilesize 64 //
sv_allowdownload 1
sv_allowupload 1

// RATES //
sv_client_min_interp_ratio 1
sv_client_max_interp_ratio 1
cl_cmdrate 66
sv_mincmdrate 66
sv_maxcmdrate 66

cl_updaterate 66
sv_minupdaterate 66
sv_maxupdaterate 66

rate 35000
sv_minrate 25000
sv_maxrate 35000


sv_ignoregrenaderadio 1
mp_flashlight 1
sv_turbophysics 1
decalfrequency 2

bot_join_after_player 0
bot_join_delay 0
*edit:
bot_quota 24

phys_pushscale 8000 // 8000 // def 1 //For funny
phys_timescale 0.5 // 0.2 // def 1 //For funny

---------------------------------------------------

autoexec.cfg:

sv_cheats 0
sv_pure 1
host_timescale 1

---------------------------------------------------

pure_server_whitelist.txt:

whitelist
{

models\player\... any
materials\models\player\... any

materials\temp\... any
materials\vgui\logos\... any
materials\vgui\logos\ui\... any


materials\mymod\... any
material\models\items\... any
materials\models\parachute\... any

models\mymod\... any
models\parachute\... any

sound\mymod\... any
sound\quake\... any
sound\gungame\... any
sound\sourcemod\mapchooser\hl1\... any
sound\misc\... any
sound\sourceod\mapchooser\tf2\... any
sound\de_favela\... any
sound\de_forest\... any
sound\admin_plugin\... any
sound\bombtimer\... any
sound\jihad\... any
sound\knifefight\chicken.wav any
sound\music\cgo_drop\... any
sound\ui\hitsound.wav any
}

Last edited by _EverGreen_; 02-12-2021 at 16:16.
_EverGreen_ is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-12-2021 , 17:24   Re: Crash with CS_OnCSWeaponDrop
Reply With Quote #18

@_EverGreen_
Those are some assembly code, you can ignore those.

You could tell us, what you want accomplish with CS_OnWeaponDrop function ?
If you want get C4 entity index... you could use event "bomb_dropped" and FindEntityByClassname
Spoiler



About crash, not much difference is it $200$ map or else.
You can test.
Add in server.cfg
Code:
bot_join_after_player 0
bot_join_delay 30
bot_knives_only

bot_quota 24
bot_add
Once bot appear 20 sec after map change, one of bots pick weapon and try to drop it -> crash.
__________________
Do not Private Message @me
Bacardi is offline
_EverGreen_
Junior Member
Join Date: Feb 2021
Old 02-12-2021 , 23:31   Re: Crash with CS_OnCSWeaponDrop
Reply With Quote #19

Quote:
Originally Posted by Bacardi View Post
@_EverGreen_
Those are some assembly code, you can ignore those.

You could tell us, what you want accomplish with CS_OnWeaponDrop function ?
If you want get C4 entity index... you could use event "bomb_dropped" and FindEntityByClassname
Spoiler



About crash, not much difference is it $200$ map or else.
You can test.
Add in server.cfg
Code:
bot_join_after_player 0
bot_join_delay 30
bot_knives_only

bot_quota 24
bot_add
Once bot appear 20 sec after map change, one of bots pick weapon and try to drop it -> crash.
Hi Bacardi and sorry for the delayed responses.

I uploaded the .sp plugin to check with plugin instead of a simple event CS_OnCSWeaponDrop

I reupload again. I say again "I'm very new and doesn't taken much programming skills on sourcemod

But this night i gonna try your suggestion. Thanks for your time!
Attached Files
File Type: sp Get Plugin or Get Source (DropBombDefuse.sp - 60 views - 14.4 KB)
_EverGreen_ is offline
_EverGreen_
Junior Member
Join Date: Feb 2021
Old 02-13-2021 , 15:34   Re: Crash with CS_OnCSWeaponDrop
Reply With Quote #20

I want say thanks @Bacardi

Your code works fine. After 15 hours of server uptime got a crash on map $6000$ but before, server load a lots of maps, every 30 minutes.

I change original code:

PHP Code:
public Action:CS_OnCSWeaponDrop(iClientiWeaponIndex)
{
    
decl String:szClassName[32];
    
GetEdictClassname(iWeaponIndexszClassNamesizeof(szClassName));
    
    if(
StrEqual(szClassName"weapon_c4"false))
    {
        
g_iC4Ent iWeaponIndex;
    }

To THIS:

PHP Code:
/// FIXED BY Bacardi ///// CREDITS TO ;)

// Weapon m_iState
#define WEAPON_NOT_CARRIED                0    // Weapon is on the ground
#define WEAPON_IS_CARRIED_BY_PLAYER        1    // This client is carrying this weapon.
#define WEAPON_IS_ACTIVE                2    // This client is carrying this weapon and it's the currently held weapon 

public OnPluginStart()
{

    
// lots of code before this

    
HookEvent("bomb_dropped"bomb_dropped); 

}

public 
void bomb_dropped(Event event, const char[] namebool dontBroadcast)
{
    
RequestFrame(nextframe);
}

public 
void nextframe(any data)
{
    
int entity = -1;

    
// There should be one c4, lets loop all weapon_c4's anyway

    
while( (entity FindEntityByClassname(entity"weapon_c4")) != -)
    {
        
//PrintToServer("m_iState %i", GetEntProp(entity, Prop_Send, "m_iState"));

        
if(GetEntProp(entityProp_Send"m_iState") == WEAPON_NOT_CARRIED)
        {
            
// stop loop on first weapon_C4 which is on ground
            
break;
        }
    }
    
    if(
entity == -1) return; // No results
    
    // Found one dropped weapon_c4
    // entity
    
    
g_iC4Ent entity// I ADD THIS LINE!!!
}  

//////////////////////////////////////////////////// 
Very thanks to all for the time, i don't know for why CS_OnCSWeaponDrop fail but this workaround using HookEvent is good.

;)

Last edited by _EverGreen_; 02-13-2021 at 15:35.
_EverGreen_ 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 13:58.


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