15.02.2017, 21:39
I would create a bool called "isFrozen" and hook TogglePlayerControllable and set the variable to true or false depending on action your doing, then use OnPlayerUpdate to check if the "isFrozen" is true for the player and then punish them.
If you use TogglePlayerControllable, they should not be able to move, so if they do while being frozen, then they are 100% using a cheat, however please be aware of ping / packet loss the player may receive, so make sure you add a delay and you check they are not desynced.
Checks:
- Freeze Player ( If you hooked TogglePlayerControllable, then IsFrozen should be true )
- Is Moving? ( Using OnPlayerUpdate check if IsFrozen[ playerid ] is true and are they moving )
- Is Desynced? ( Create a new variable to hold the times the player has moved and increment it, if it goes over 5 or so desync them and kick them from server )
- Not Desynced? ( So they are not desynced and they are moving, I would suggest warning admins or if your perfectly sure you have tested this approach then ban them. )
I have not tested this myself, I have a similar system myself, however I did my system in C++ 3 years ago, so I can't confirm whether this approach is 100% accurate, I may have missed something vital. I would suggest you do some research and testing.
If you use TogglePlayerControllable, they should not be able to move, so if they do while being frozen, then they are 100% using a cheat, however please be aware of ping / packet loss the player may receive, so make sure you add a delay and you check they are not desynced.
Checks:
- Freeze Player ( If you hooked TogglePlayerControllable, then IsFrozen should be true )
- Is Moving? ( Using OnPlayerUpdate check if IsFrozen[ playerid ] is true and are they moving )
- Is Desynced? ( Create a new variable to hold the times the player has moved and increment it, if it goes over 5 or so desync them and kick them from server )
- Not Desynced? ( So they are not desynced and they are moving, I would suggest warning admins or if your perfectly sure you have tested this approach then ban them. )
I have not tested this myself, I have a similar system myself, however I did my system in C++ 3 years ago, so I can't confirm whether this approach is 100% accurate, I may have missed something vital. I would suggest you do some research and testing.