Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork46
Description
I assume that this is a rare SampSharp bug that occurs in some weirdly specific situation as I have no other explanation for this. On my server it randomly started sending double messages in chat to every player. Never had this happen before, and haven't done any changes to the chat logic that could've caused it.
The OOC command loops through every Player and does SendClientMessage, so I don't think there can go much wrong on my side. It almost feels like there are two of the same Player entities.
Unfortunately there isn't much else I can tell you to narrow down the potential issue, it randomly happened after I logged in, before that everything was fine. Here is the /ooc code:
publicclassChatCommands:ISystem{[ServerCommand(PermissionGroups=newstring[]{"Default"},Description="Send a message to the global Out-Of-Character (OOC) chat. Use /ooc followed by your message to communicate OOCly with all players.",CommandGroups=new[]{"Chat"})]publicvoidOoc(Playerplayer,IEntityManagerentityManager,IDiscordServicediscordService,stringtext){if(player.IsPlayerPlayingAsCharacter()){player.SendPlayerChatMessage(entityManager,PlayerChatMessageType.OOC,text);discordService.SendGlobalOocChatMessage(player,text);}}}publicstaticclassChatHelper{publicstaticvoidSendPlayerChatMessage(thisPlayerplayer,IEntityManagerentityManager,PlayerChatMessageTypetype,stringtext){if(player.IsPlayerPlayingAsCharacter()){CharacterModelcharacter=player.GetPlayerCurrentlyPlayingAsCharacterModel();switch(type){casePlayerChatMessageType.OOC:stringCHAT_ACTION_OOC=String.Format("(( OOC | {0}: {1} ))",character.GetCharacterName(),text);foreach(PlayerforeachPlayerinentityManager.GetComponents<Player>()){foreachPlayer.SendClientMessage("{D3D3D3}"+CHAT_ACTION_OOC);}break;}}}}
I'm curious if anyone else has ever had this issue?
I have a Discord bot that sends messages from /ooc to Discord, and in Discord only one message appears, which is another reason that leads me to believe this might be a rare SampSharp bug.
