Jump to content

Clientsided Spam


Recommended Posts


Someone can help me?

I have a Tablet with apps and when the user is clicking on the app its triggering C# Server-event. But user can spam button even when i set the called function in a timer. Does someone have a good and easy idea how to disable for example getting commands by the player for 5 seconds?


Link to comment
Share on other sites

First create a timer system that runs on [ServerEvent(Event.Update)] and invokes an Action when the time is up.

That way you can do SetEntityData("cooldown", true) on the player if they execute the command and if they execute it again and the player HasEntityData("cooldown") just return out.

If they don't have the data, SetEntityData("cooldown") again, execute your command code, then create a timer CreateTimer(() => { ResetEntityData("cooldown"); }, 5000) which in 5 seconds removes the entity data.


I'm not home at the moment but if you are struggling to make a timer system I can give you mine later.

Link to comment
Share on other sites

10 hours ago, Faui said:

It would be sick if you could send me yours my friend - Awesome!!! I done many timers with c# but is not working as i want it - So i would really celebrate it!!! Write me a PN 🙂

I just realized this was implemented long ago into the actual bridge API and serves your needs perfectly fine.

public class Example : Script
        public void CCExample(Client player)
            if (player.HasData("cooldown"))

            player.SetData("cooldown", true);


            NAPI.Task.Run(() =>
            }, 5000);


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...