Currently the developers are putting their own money into JC2-MP to keep the servers online.

Please take a few seconds of your time and disable your AdBlock plugin for our website.

Ad revenue is not going to developers, it is used purely for covering our hosting costs.

 

You are also free to donate, which removes all ads from our website!

Patch 0.3 was just released! Full changelog here: https://t.co/4A50m6IKen

2 years ago

Advertisement
September 20, 2019, 10:29:48 pm

Author Topic: [Release] Basic Anti-Cheat  (Read 431 times)

MrQWERTYU

  • Newbie
  • *
  • Posts: 25
    • View Profile
[Release] Basic Anti-Cheat
« on: July 10, 2019, 08:54:36 pm »
* At the moment, it protects only from invulnerable players.
Basic Anti-Cheat
Basic Anti-Cheat for your server.

WARNING: Anti-cheat will trigger on events ply.invulnerable and ply.makeinvulnerable, please read the information for server developers from below. Do not use this plugin if you don't know what to do.

Download:
- GitHub

For server developers:
Use this event to enable/disable Anti-Cheat:
Code: Lua
  1. Events:Fire( "AntiCheat", {acActive = true/false} )

Use this event to enable/disable Anti-Cheat Bullet hit check:
Code: Lua
  1. Events:Fire( "AntiCheat", {acBulletCheck = true/false} )

Use this event to enable/disable Anti-Cheat Explosion hit check:
Code: Lua
  1. Events:Fire( "AntiCheat", {acExplosionCheck = true/false} )

  • true - Enable
  • false - Disable

Example:
For example ProperPassive plugin...
Code: Lua
  1. function Passive:NetworkObjectValueChange(args)
  2.   if args.key == "Passive" and args.object.__type == "LocalPlayer" then
  3.     if args.value then
  4.       Game:FireEvent("ply.invulnerable")
  5.       Events:Fire( "AntiCheat", {acActive = false} )
  6.     else
  7.       Game:FireEvent("ply.vulnerable")
  8.       Events:Fire( "AntiCheat", {acActive = true} )
  9.     end
  10.   end
  11. end
« Last Edit: July 10, 2019, 09:03:17 pm by MrQWERTYU »

keeri

  • Developer
  • Sr. Member
  • *****
  • Posts: 295
    • View Profile
Re: [Release] Basic Anti-Cheat
« Reply #1 on: September 16, 2019, 03:22:27 pm »
the server module runs in a single instance (not per player like the client modules do), so having
Code: [Select]
self.phealth = 1on the server means it will get overwritten by each player; if you want to store values per-player, use sender:SetValue(key, value) and sender:GetValue(key). you can also use a table of player values:
Code: [Select]
self.phealth = {}

self.phealth[ sender:GetId() ] = sender:GetHealth()
but you will need to manually clear them on PlayerQuit event by setting their value to nil.

Code: [Select]
function GodCheck:CheckThisPlayer( args, sender )
self.phealth = sender:GetHealth()
if sender:GetHealth() >= self.phealth then
that's equivalent to "if true then", since you overwrite the previous value with current value before performing the checks