#Need help with a hint plugin, made with HSM.

1 messages · Page 1 of 1 (latest)

river orbit
#

I'm new to this, and I used a 40-minute tutorial on LabAPI that I found on YouTube to do this.

ChatGPT helped me a lot, but as everyone knows, it's never going to do things right, especially when it comes to specific things like LabAPI and HintServiceMeow.

The problem I have is that I don't know how to make a rotating message. I also can't change the settings, because when I change them, nothing happens in the hints, and when I start the round, for some reason the screen stays black and nothing happens, and the hints remain there.

My idea was to make an overlay for WaitingPlayers that shows information from the previous round, the server title, and a rotating tip message at the bottom.

Thank you very much for reading this. I would greatly appreciate your help and apologize for my ignorance. I am just learning and would like some advice on how to avoid this kind of thing.

I'm going to upload my project files. I hope you can help me.

#

I really appreciate anyone who takes the time to review this and try to help me.

small jackal
#

do you have any errors?

#

so you currently have only one Player rotativoPlayer in your EventsHandler class so that's wrong, if you want something to happen to multiple players, you either need to store all of those players in a global-like context (so change rotativoPlayer to a List<Player> and add to it OnPlayerJoinedetc...) or run your action on each player (in your case starting a new timer in OnPlayerJoined) I also think you should use MEC coroutines instead of timers (if you cant find the MEC namespace, reference Assembly-CSharp-firstpass).

I personally would start a coroutine in OnServerWaitingForPlayers and store it in EventsHandler as a static CoroutineHandle to make OnServerWaitingForPlayers only create the coroutine if it doesnt exist already. Then in OnPlayerJoined add to a static List<Player> in EventsHandler (make sure the list defaults to a value like [] or new()) which is then referenced in the coroutine, which checks if the round is started, kills itself if so, and then make the coroutine iterate every 5 seconds, and make that coroutine modify a static string in EventsHandler, and make it so in OnPlayerJoined, players get a hint that has your positions and font size etc... but no Text, instead it will have an AutoText that goes to the static string in EventsHandler after checking the round hasnt started, meaning when your coroutine changes that string, every hint will automatically update to it (and changing the hints SyncSpeed will change how fast it updates). You dont ever need to remove this hint or anything btw, if you make sure you dont duplicate coroutines across rounds and control everything properly, it should be pretty simple.

An example of the AutoText for the hint is:

AutoText = _ => Round.IsRoundStarted ? string.Empty : EventsHandler.HintValue,

where EventsHandler.HintValue is the static string I mentioned earlier. I hope this helps! Maybe ChatGPT can help you understand what I tried to communicate

river orbit
small jackal
#

Could you send your plugin files again then? (So I can check everything)

small jackal
#

Alr I’ll take a look later, I’m not at my PC rn

small jackal
#

so first thing I've noticed so far: This will throw an NRE when called in OnWaitingForPlayers first because rotacionHandle will be null, you should add a check if t he handle is null so:

if (rotacionHandle is not null && Timing.IsRunning(rotacionHandle))
  return;
#

and this event is called when nobody is on the server (just trust me on that) so you can remove that foreach over every player and just initialize your constants and start the coroutine if possible

small jackal
#

yeah you might not need that check, idk

#

in your PrintarOverlayPara method, it adds all those hints (besides the auto one) that dont get removed when the round starts. If you want to remove them, you can add an Id in their hint, then when the round starts, foreach ever player, get their PlayerDisplay, then I think there's a method display.RemoveHint(id); that can remove hints based on id, so use that

#

I dont see anything here that'd make players not connect

#

maybe you want to temporarily not register your Stats events and just let it be default data for now for debugging?

burnt swift
#

bro can just turn on la logs
slfolder/config/{port}/config_localadmin.txt
la_show_stdout_and_stderr: true
and you will see in console what is wrong

river orbit
#

i fixed the freeze on round start, now it freezes like 3 seconds after round started and my health goes to 0, probably i made a mistake with the handler of damage

river orbit
#

ill be back in 3-4 hours

small jackal
#

alr, but why do you have a reload command in the first place?

#

and what's the respone of the command?

river orbit
small jackal
#

Plugin::LoadConfigs();

river orbit
small jackal
#

I dont think you need to override LoadConfigs, but all it should do is change the plugin's singleton's config's instance.

#

so anything referencing the config should reference the new one

river orbit
river orbit
#

When the round starts, I appear as class d and a few seconds later my life drops to 0 and I freeze, no doors can be opened and no interaction is possible.

main flame
river orbit
# main flame Check your player logs and local admin logs

[2025-08-13 12:26:14.085 -03:00] New round has been started.
[2025-08-13 12:26:19.470 -03:00] [STDOUT] Unknown message id: 46055. This can happen if no handler was registered for this message.
[2025-08-13 12:26:19.471 -03:00] [STDOUT] NetworkClient: failed to unpack and invoke message. Disconnecting.
[2025-08-13 12:26:19.473 -03:00] [STDOUT] HandleData Unknown connectionId:0
[2025-08-13 12:26:19.474 -03:00] [STDOUT] HandleData Unknown connectionId:0
[2025-08-13 12:26:19.474 -03:00] [STDOUT] HandleData Unknown connectionId:0
[2025-08-13 12:26:19.474 -03:00] [STDOUT] HandleData Unknown connectionId:0
[2025-08-13 12:26:19.474 -03:00] [STDOUT] HandleData Unknown connectionId:0
[2025-08-13 12:26:19.474 -03:00] [STDOUT] HandleData Unknown connectionId:0
[2025-08-13 12:26:19.475 -03:00] [STDOUT] HandleData Unknown connectionId:0
[2025-08-13 12:26:19.475 -03:00] [STDOUT] HandleData Unknown connectionId:0
[2025-08-13 12:26:19.475 -03:00] [STDOUT] HandleData Unknown connectionId:0
[2025-08-13 12:26:19.475 -03:00] [STDOUT] HandleData Unknown connectionId:0
[2025-08-13 12:26:19.476 -03:00] [STDOUT] HandleData Unknown connectionId:0
[2025-08-13 12:26:19.476 -03:00] [STDOUT] HandleData Unknown connectionId:0
[2025-08-13 12:26:19.476 -03:00] [STDOUT] HandleData Unknown connectionId:0
[2025-08-13 12:26:19.476 -03:00] [STDOUT] HandleData Unknown connectionId:0
[2025-08-13 12:26:19.480 -03:00] [STDOUT] Skipped Data message handling because connection is null.

This would work?

river orbit
# river orbit [2025-08-13 12:26:14.085 -03:00] New round has been started. [2025-08-13 12:26:1...

this happens in this events:

    public override void OnServerWaitingForPlayers()
    {
        overlayActivo = true;
        indiceMensaje = 0;
        HintRotativoValor = string.Empty;

        IniciarRotacionSiHaceFalta();
    }

    public override void OnPlayerJoined(PlayerJoinedEventArgs ev)
    {
        if (!overlayActivo || Round.IsRoundStarted) return;
        PintarOverlayPara(ev.Player);
    }

public override void OnServerRoundStarted()
{
overlayActivo = false;
PararRotacion();

Timing.RunCoroutine(RemoverRotativoLuegoResto());

}

If i remove this, then that error doesnt happen, the thing is, i dont know what is causing the problem

jade pendant
#

Off-topic here cause I'm lurking but @small jackal you know Axo?

#

He's on our mutual friends which is a bit of a surprise to me lol