File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -664,19 +664,24 @@ func (geh gameEventHandler) playerConnect(data map[string]*msg.CSVCMsg_GameEvent
664664}
665665
666666func (geh gameEventHandler ) playerDisconnect (data map [string ]* msg.CSVCMsg_GameEventKeyT ) {
667+ uid := int (data ["userid" ].GetValShort ())
668+ pl := geh .playerByUserID (uid )
669+
667670 if geh .parser .isSource2 () {
671+ if pl != nil && pl .IsBot {
672+ geh .dispatch (events.PlayerDisconnected {
673+ Player : pl ,
674+ })
675+ }
668676 return
669677 }
670678
671- uid := int (data ["userid" ].GetValShort ())
672-
673679 for k , v := range geh .parser .rawPlayers {
674680 if v .UserID == uid {
675681 delete (geh .parser .rawPlayers , k )
676682 }
677683 }
678684
679- pl := geh .playerByUserID (uid )
680685 if pl != nil {
681686 // Dispatch this event early since we delete the player on the next line
682687 geh .dispatch (events.PlayerDisconnected {
You can’t perform that action at this time.
0 commit comments