Anti-Lag
#1

If you're not familar with what I mean by 'anti-lag', here's a brief thing:

Because of lag, you have to 'lead' the player you're shooting at, which sucks. Lag compensation would be awesome, but Kye has stated that he tried to add this and it didn't work great, and I can't see it being added any time soon. What he did do which is really awesome though, is add the callback 'OnPlayerGiveDamage'. This callback is fired when YOU damage a player, not when THEY take the damage, which means lag/latency is completely gone.

This may seem like the most awesome thing ever, unfortunately, with most things in life, if it sound too good to be true.......


1. Cheating

Kye has said this himself. I can't find the post (it may be gone now) but he basically said that it may be possible to hack it so you can 'fake' damage being given, as the client reports this to the server.

2. Controllers/Joypads can Auto-Aim/Lock-On

Joypads/controllers (as you may know) can auto-aim or 'lock-on' to targets and EVERY shot will hit. This is obviously a massive advantage. The only slight thing is, that it can happen in reverse. If a player with a mouse aims NEAR a player that is using a joypad, the joypad user will see that the mouse user, even though not aiming directly at the player, is locked on, and it's very hard to escape this. They will take all the damage, even if the mouse user never actually hits them on their screen.

What's your opinion on this? I REALLY want to use anti-lag on my server, but these two things are making it seem a less and less viable option.
Reply
#2

The best way to use Anti-lag is to create a hybrid type system where you can lead aim but also shoot the skin if you want due to the nature of this kind of system you will need to have a delay to see if a player has any OnPlayerTakeDamage() happen in this case you cancel the OnPlayerGiveDamage(). We've had some excellent results with this type of system being well suited and balanced for online play since the damage cycle of OnPlayerGiveDamage() is 300ms per message it tones down the excessive damage as a result which quells rapid-fire cbugging. I should also note since it will only process one per 300ms any additional messages are ignored until this is complete or an OnPlayerTakeDamage() is received, there is no need for putting all the players on the same team which is so lame with most anti-lag systems as a lead aim shot will stun you but no damage is lost. In terms of cheating we've never had anyone send fake messages yet that isn't much of an issue in fact it's usually quite the opposite making cheating more difficult.

Edit - There is a lot of stuff you need to do to set this up correctly, I wouldn't recommend using OnPlayerDeath() it's better to make your own call back I usually use OnPlayerDeathEx() then set OnPlayerDeath() { return 1; } now you'll need to detect when a player is killed. I send the message from OnPlayerGiveDamage() to a hit issuer function which will directly call OnPlayerTakeDamage() from there you process the damage and set it with SetPlayerArmour() and SetPlayerHealth() then call OnPlayerDeathEx() when a kill is detected. You'll also need to use OnPlayerStateChange() since some deaths are not detected in OnPlayerTakeDamage(). Contact me if you need more information I've written several of these systems and have done literally months of testing and tweaking so I have a pretty good idea of all situations you'll encounter.
Reply
#3

Not sure what that has to do with anything I mentioned, but okay.
Reply
#4

For mine I only used OnPlayerGiveDamage.
I put everyone on teamid 1 so that no one could hurt each other, and then checked under opgd a few things like if they were on opposite teams, if they were not in shop mode, not spawn kill protected, not already dead and the player shooting was not already dead.

Since all health and armour variables were stored on the server and then displayed on the clients I knew when someone would die, the killerid and the reason before they would.
I saved the killerid and reason with variables and under OnPlayerDeath used the variables instead of whatever would of been reported. (Also making sure the killerid was still connected)

1. Cheating
There were only a couple cheaters that were ever a threat, one that did fake killing which was easily detected since if no damage was reported how can there be a killer?
And another with rapid fire weapons like a rapid fire sniper rifle, which I detected and blocked by getting the time intervals of every weapon and stopping the damage if it was too fast.

2. Controllers/Joypads can Auto-Aim/Lock-On
They weren't really a threat although I did have detection and a kick for them, seeing as joypad users never return an id for GetPlayerTargetPlayer.

I did have to put up a few things to make it easier for players being shot though.
1. Everyone on the opposite team had no name tag or map marker.
2. On being hit, the person that hit you would have their name tag revealed and their map marker visible for you until your death or theirs.
3. Also added a tagging system where you aim at a person and press the 'NO' key then they'd have their name tag visible and map marker for your whole team until their death.
4. On being hit, a textdraw would display showing how much damage you're taking which would stack or disappear within a few seconds.

The main reason I did it was to get rid of health locking cheaters, but I also thought it'd be interesting and I had gotten very sick of lead aiming.
Reply
#5

I personally use a PS3 controller, and I wouldn't re-join a server that kicked me for using it!

It's very tempting for me to go ahead with this, but I'm really not sure. It's almost impossible to detect auto-aiming (even with the target function - if a player shoots with a mouse and keyboard from medium range they won't show a target and your method will make the script think they're using a joypad).

What would really be awesome would be a function to disable controller lock-on.
Reply
#6

I'm wondering, if you set the same team for all players and shoot with an RPG/hunter rocket / hydra near them, does OnPlayerGiveDamage get called? Or will the players be 'explosion invincible'?
Reply
#7

Quote:
Originally Posted by Gamer_Z
View Post
I'm wondering, if you set the same team for all players and shoot with an RPG/hunter rocket / hydra near them, does OnPlayerGiveDamage get called? Or will the players be 'explosion invincible'?
I'm pretty sure explosions are invincible I know nades don't get called so I'm guessing it should be the same for these weapons, but like I mentioned anti-lag with everyone on the same team is lame.
Reply
#8

The only anti-lag server I've ever visited that was decent was cessil's and he's basically mastered it. It works perfectly, go give it a try, and listen to his tips - he knows what he's talking about.
Reply
#9

I wouldn't say perfectly, but with current stuff ye it's pretty good... Lag is still present just in a different way. They can be off screen on your screen but you're on theirs due to latency and kill you
Reply
#10

It's been discussed multiple times, nowadays there are two-three disadvantages of this system.
First and most important - the aimhackers. You just can't detect them without an admin test.
the second would be the latency lags. People get desynced and you can't change their health by SetPlayerHealth, so they get reported by other players of being invulnerable.
And the last - you can't give grenade and rocketlauncher damage.
Reply
#11

Quote:
Originally Posted by wups
Посмотреть сообщение
And the last - you can't give grenade and rocketlauncher damage.
Really? Works fine for me.
Reply
#12

I'm also using the lag shooting thing, call it synced shooting if you want (although other players don't see you aiming directly at them).

I think that you could try do what Cessil does with some changes to suit your gamemode.
Reply
#13

Quote:
Originally Posted by wups
Посмотреть сообщение
It's been discussed multiple times, nowadays there are two-three disadvantages of this system.
First and most important - the aimhackers. You just can't detect them without an admin test.
the second would be the latency lags. People get desynced and you can't change their health by SetPlayerHealth, so they get reported by other players of being invulnerable.
And the last - you can't give grenade and rocketlauncher damage.
If you read how my system works grenades and rl will work but those are lamer weapons anyways

MP2 - Did you set all players to the same team?
Reply
#14

I don't have any issues about HOW to do this. I created this discussion to weigh out the pros and cons and see what other people thought. If I wanted help with getting this working, I would have asked.


EDIT: Disregard what I said in my last post. I wasn't using OnPlayerGiveDamage. Perhaps grenades/RPGs etc. don't work. Yet another reason not to use it.
Reply
#15

Quote:
Originally Posted by wups
Посмотреть сообщение
the second would be the latency lags. People get desynced and you can't change their health by SetPlayerHealth, so they get reported by other players of being invulnerable.
There's ways to fix that like kicking if their health doesn't update and setting their colour to something else when they're meant to die so they could be running around with a grey name shooting people but others would know that he is dead and can't take or give damage.

Quote:
Originally Posted by MP2
Посмотреть сообщение
EDIT: Disregard what I said in my last post. I wasn't using OnPlayerGiveDamage. Perhaps grenades/RPGs etc. don't work. Yet another reason not to use it.
There would be ways of detecting if a player had been near an explosion but wouldn't be accurate, checking their velocity increases, since walking and falling have an increased velocity and an explosion is a sudden velocity change.
However if 2 people throw a grenade at someone who did the damage?
Also other factors like getting hit by a car would increase their velocity sharply too
Reply
#16

As for the grenades, and all explosions actually I think its okay to use OnPlayerTakeDamage, in fact that would be even better!

If OnPlayerGiveDamage would report about grenade damage for example, it would be synchronized with OnPlayerTakeDamage.

But do grenades do any damage to a player if they are both on the same team?
Reply
#17

No but the callback gets called anyway.
Reply
#18

Edited
Reply
#19

Using a system like this on my server, tweaked it quite a bit so it works flawlessly now.
I found an anti-autoaim script before, i think i have it saved somewhere.

I have a few tips for people that i had to figure out myself..

These weapons/methods doesn't work with OnPlayerGiveDamage, but they do however work with OnPlayerTakeDamage:
  • Explosives
  • Heli Blades
  • Vehicle Ramming
  • Driveby aim-assist
Use SetPlayerTeam within OnPlayerConnect (set all players to the same team) to disable all damage players cause to eachother, and if you have teams in your script, use variables for blocking team damage if you want to.

Use variables for storing health and armour, because if you use GetPlayerHealth and GetPlayerArmour together with rapid fire weapons things tend to get delayed and wierd.

Use your own function and call it within OnPlayerGiveDamage and OnPlayerTakeDamage, under some circumstances explained above.

Also use OnPlayerTakeDamage + if the issuerid isn't connected, as a way to keep track on damage, and saving the new values to your eventual health variables.

Drown and fall damage takes health damage even if you have armour.

Check within the function you made for synced damage; if the player's health/armour - amount equals death.
If it does, save the reason and killerid into a variable, which can be read within OnPlayerDeath
Reply
#20

Very good idea at cessil, when i have the time i want use this system for increase the damage its not perfectly just with SetPlayerHealth/Armour on OnPlayerTakeDamage but if all player its in the same team its possible i think. And we can use this system for anti cheat godmode.

https://sampforum.blast.hk/showthread.php?tid=431337
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)