I am trying to add an Number to an array inside of a rep notify. For some reason on the client it is usually added twice. I can’t figure out why or how to fix this, if it is even possible. Anyone have ideas?
I think I figured it out (hopefully the proper way to do it), you have to add a “Switch has Authority” node in the OnRep function; and then connect the Authority to the function/node you want to replicated (in my case, connected to the Add function).
What I dont get is why wouldnt this always be done when using any rep notify event that deals with numbers or Booleans that are not arrays but just single variables. Does anyone have any input on that?
RepNotifies run on both client and server.
Server sets Number (repnotify)
OnRep Number adds it the Array which is replicated.
Client gets replicated (updated array), then adds the new number to it again via onrep number function.
Don’t replicate the array.
Have the server set a number, onrep number will add it on both server and client to the array.
To double check, you were saying not to check the box “Replicate” on the Array variable? I thought it needs to replicated though if you want to avoid cheating?
Don’t check replicate on the array variable. It’s a container of “Legit” values sent from the server.
The “Number” variable (RepNotify) updates the array in the OnRep Number function.
As long as the client doesn’t modify the array through cheating your fine. Either way a cheating client could modify the replicated array or outright ignore it.
For some clarity modern cheats of the “pay for” type are DKOM Kernel level access cheats. They have direct access to the PC’s memory and can completely hide themselves from just about every client-side anti-cheat. Battleye, VAC, EAC etc.
You aren’t going to prevent cheating with client-side AC. You need to focus on Server-side prevention and mitigation. Scrutinize and Validate client inputs and actions. This does have an impact on server performance which is why it isn’t heavily used.
RevOverDrive is correct however i’d use Repnotify on the array and just modify the array on server.
i can only see problems repnotifying a variable to add to the array, for instance if the server updates the variable twice the client may only receive the latest update
If you just need a value replicated use basic replication. RepNotify adds the onrep function execution. Meaning you’re supposed to do something immediately with the updated data.
There’s also netcull distance, priority and relevance to consider.
All boils down to design.
agreed, what i meant was replicate the array not the int,
in the example above if you wanted to add 2 items to the array you have to replicate the same int twice which both makes no sense (to me) and could fail
Hey @Rev0verDrive, I’m rereading everything again, and based on how you two are saying everything it sounds conflicting and a little confusing to me.
-
You said don’t replicate the array, @Auran131 said to replicate the array, then said for some reason to replicate the array and not the int, which to me means I wouldnt even be using a repnotify event is my understanding, which would also mean a new player coming in wont be updated on the previous numbers in the array, just newly added numbers.
-
Regarding cheating, it appears you said you arnt going to prevent cheating with client side AC (I dont know what AC is). However, you then appear to say it is possible through server side and validating inputs and actions. This confuses me a little because it appears that I am using Server side checks as the “Server_UpdateNumber” function is a Run On Server custom event. If I don’t want extra numbers being added to the array by a cheater, wouldnt I then need to replicate the array like I have done in my example pictures?
Sorry to confuse you,
Rev was answering your question based on what you “are doing” and i was answering based on what you are likely “trying to do”
‘IF’ you are just trying to update the array, then just set it on server and Replicate, or Repnotify if you want a client reaction. no other steps needed.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.