4.2 (4.0 +)
How can I protect the arguments of an RPC function for a certain type? I have a multiplayer made based on
ENetMultiplayerPeer. Is there any RPC strictness settings or something like that in it or in the Node’s `multiplayer’ parameter?
func rpc_function(vector3, some_int) -> void:
And I just can’t specify the types of arguments due to the fact that there may be an error when the cheater calls RPC with incorrect arguments and everyone’s game breaks
You can validate the variants when the function is called.
If typeof(vector3) != TYPE_VECTOR3 and typeof(some_int)
This is off the top of my head, but should get you close enough.
yes I’ve already done this in all RPC’s, but it’s inconvenient and I’m trying to use maximum “typecasting” in scripts and I have a lot of warns because of this.
So there are no other options yet?
IDK what to say. You can put vector3:Variant as the parameter type, that will type it to basically “any”. Should get rid of the warning. And then still do the typeof check.
My next suggestion would be to use MultiplayerSynchronizer. A little harder to mess with on the client side. Although I’m not sure how hard it validates incoming data. I need to look at the source again. I think it should do some checks for you.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.