Block inputs for specific gamemode

Hello …i have kinda hit a wall im working on a gamemode thats kinda like sumo wrestling my problem is since my game is an fps i can still fire guns and i know that gamemodes are controlled by the server but i wanted to know if i can or how i m able to block inputs for just this gamemode type for clients aswell so there unable to shoot or aim but still use the other keys… thanks in advance

I don’t know much about multiplayer, but I do know about the rest.

You can’t stop a gamemode from receiving input, that’s the controller. You stop the controller from receiving input.

Also, if you have various players using the same gamemode, they will each have their own controller, you need to stop input on each controller.

If you want to only stop certain kinds of input, then you need to leave the controller intact, and stop or reroute the input in the BP that’s processing the input.

ok but is there a way i can tell if its that gamemode so i can stop the input in my character? because have tried casting to my gamemode as an enum with a branch in my character but that but that only works for the server and i also need the client

Like I say, to stop the input, you need the controller, not the game mode. If you just get the controller, you can stop the input.

What I mean is, GetPlayerController will get the right thing regardless of which game mode or controller you’re using.

EDIT: I guess you could sort of block depending on game mode. On a certain signal, inside the player you can get the game mode, if it is the correct game mode, then get the controller and block input.

What kind of signal that is, is up to you. Maybe just a custom event, or the player could bind to an event in the game mode on begin play, etc…

casting to my gamemode as an enum with
a branch in my character but that but
that only works for the server and i
also need the client

The game mode only exists on the server, the clients can never access anything of it, since it does not exist there. What are you trying to achieve?

i have a shooter and i wanted to stop the clients from being able to use the code that i use to shoot but only for this one game type so thats why i was trying to figure out if there was a way to stop that and how i would get them to know this is the mode they can’t do it on. would it be easier to just do it in the level bp as long as i only use those levels for that gamemode?

You could create a boolean or an enum variable inside the pawn/player controller (depending on where you handle the shooting input) and then only execute the logic based on the boolean or enum value (instead of casting to the “game mode” every time).

Further mark this variable to be “replicating” (so you only need to set it on the server and will automatically be set on the clients as well).

Then in the “event begin play” of the pawn/player controller you could cast to the “game mode” and set this variable on the server (“switch has authority” to determine whether the server is executing this or the client). Since the variable is set to replicate, the clients will also know about this.

i apologize seeing as im not really visualizing it but from reading what you wrote(probably way off) i think it looks like this

In the first image, you would need to execute that on the server instead of on the owning client (since only the server can access the gamemode).

The client will then automatically know about the value of “NewVar0” since it is set to replicate.

idk man it either block everything or does nothing at all so i think im just gonna give up on it…thanks for trying to help

You could do something like this:

Inside the character blueprint:

“GetGameModeEnum” is a function inside an interface, and each of your gamemodes would need to implement that interface (This is just to get the enum value, there are also be other ways to get it).

And this is the “CanFireByGameMode” function.