SA-MP Forums Archive
[Include] lagcomp.inc - Fixed lagcomp response; custom weapon damage; serversided damage handling - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] lagcomp.inc - Fixed lagcomp response; custom weapon damage; serversided damage handling (/showthread.php?tid=633094)

Pages: 1 2 3


lagcomp.inc - Fixed lagcomp response; custom weapon damage; serversided damage handling - Gammix - 25.04.2017

Lagcomp.inc
Version: 2.0 | Last Updated: 5 Sept, 2017


Lagcomp is a simple include which fixes SAMP lagcomp response and detection vastly. There are some advantages too such as protection against Fake kills and since the damage system is all server sided, there is no way hackers can hack Weapon damage values.

Since the damage system is server sided, you can set the weapon's damage per player:
(Note: the damage value is only override for Player giving Player damage, for self damage, these functions don't work)
PHP Code:
SetPlayerWeaponDamage(playeridweaponidFloat:damage);
Float:GetPlayerWeaponDamage(playeridweaponid); 
Installation Download
https://github.com/Agneese-Saini/SA-...de/lagcomp.inc

Credits
Slice - "ProcessDamage" function with the damage data array
Humza - Testing the script


Re: lagcomp.inc - Fixed lagcomp response; custom weapon damage; serversided damage handling - Max_Andolini - 25.04.2017

Good job!


Re: lagcomp.inc - Fixed lagcomp response - Logic_ - 25.04.2017

Wasn't this was going to be in the server-sided include which you removed lately?


Re: lagcomp.inc - Fixed lagcomp response - Gammix - 25.04.2017

Quote:
Originally Posted by Logic_
View Post
Wasn't this was going to be in the server-sided include which you removed lately?
serversided wasn't gonna make it since you required SKY plugin and everything slice did in weapon-config. So that's why there was no point in making a copy.

This only fixes your lagcomp. This can be further developed for an anti cheat. I guess i will make anti health and armor from this.


Re: lagcomp.inc - Fixed lagcomp response - Killa[DGZ] - 25.04.2017

Good release Gammix!,

But isn't this completely useless?, as 'OnPlayerGiveDamage' and 'OnPlayerTakeDamage' can both be faked by some fake kill cheats?


EDIT: Ahh I see, damage checks.. thats very clever indeed


Re: lagcomp.inc - Fixed lagcomp response - Gammix - 25.04.2017

Quote:
Originally Posted by Killa[DGZ]
View Post
Good release Gammix!,

But isn't this completely useless?, as 'OnPlayerGiveDamage' and 'OnPlayerTakeDamage' can both be faked by some fake kill cheats?


EDIT: Ahh I see, damage checks.. thats very clever indeed
I forgot to mention this also has protection against fake kills


Re: lagcomp.inc - Fixed lagcomp response - Killa[DGZ] - 25.04.2017

Quote:
Originally Posted by Gammix
View Post
I forgot to mention this also has protection against fake kills
Small issue?,

line 488 : warning 202: number of arguments does not match definition
PHP Code:
return LC_OnPlayerTakeDamage(playeridissueridamountweaponidbodypart); 
line 500 : error 025: function heading differs from prototype
PHP Code:
forward LC_OnPlayerTakeDamage(playeridissueridFloat:amountweaponidbodypart); 
line 550 : warning 202: number of arguments does not match definition
PHP Code:
LC_OnPlayerTakeDamage(damagedidplayeridamountweaponidbodypart); 
I'm already using the native within my gamemode.. could that be it?


Re: lagcomp.inc - Fixed lagcomp response - Gammix - 25.04.2017

Quote:
Originally Posted by Killa[DGZ]
View Post
Small issue?,

line 488 : warning 202: number of arguments does not match definition
PHP Code:
return LC_OnPlayerTakeDamage(playeridissueridamountweaponidbodypart); 
line 500 : error 025: function heading differs from prototype
PHP Code:
forward LC_OnPlayerTakeDamage(playeridissueridFloat:amountweaponidbodypart); 
line 550 : warning 202: number of arguments does not match definition
PHP Code:
LC_OnPlayerTakeDamage(damagedidplayeridamountweaponidbodypart); 
I'm already using the native within my gamemode.. could that be it?
One of your include is using a different set of parameters for OnPlayerTakeDamage.


Re: lagcomp.inc - Fixed lagcomp response - Killa[DGZ] - 25.04.2017

You were right, I was simply missing the 'bodypart' parameter from the function heading within my gamemode..
PHP Code:
OnPlayerTakeDamage(playeridissueridFloat:amountweaponid
Thanks.


Re: lagcomp.inc - Fixed lagcomp response - Killa[DGZ] - 26.04.2017

A few small issues with this, tested with 10 players within a deathmatch.

You get full armour everytime you kill somebody?(confirmed multiple times)
Sometimes when shooting someone you lose health instead of the target?(confirmed multiple times)


Re: lagcomp.inc - Fixed lagcomp response - Gammix - 26.04.2017

Quote:
Originally Posted by Killa[DGZ]
View Post
A few small issues with this, tested with 10 players within a deathmatch.

You get full armour everytime you kill somebody?(confirmed multiple times)
Sometimes when shooting someone you lose health instead of the target?(confirmed multiple times)
Yea right, i see the mistakes in code but i will be able to update the include by tomorrow.


Re: lagcomp.inc - Fixed lagcomp response - Killa[DGZ] - 26.04.2017

Alright man whenever you can.. thanks very much, it really does improve things quite substantially.

EDIT: Fake killing is still possible also Gammix, I was just fake killed by someone while driving(they were passenger), instead now I actually die when they fake kill me due to the damage sync your include provides, which must mean that they're calling OnPlayerTake/GiveDamage with damage values?

They had no weapons.


Re: lagcomp.inc - Fixed lagcomp response - Kar - 26.04.2017

What exactly is wrong with the current lagcomp?


Re: lagcomp.inc - Fixed lagcomp response - Killa[DGZ] - 26.04.2017

Quote:
Originally Posted by Kar
View Post
What exactly is wrong with the current lagcomp?
Well for starters it has more delay than an old amstrad computer?.. using this include makes giving/taking damage much much better.


Re: lagcomp.inc - Fixed lagcomp response - Kar - 26.04.2017

Quote:
Originally Posted by Killa[DGZ]
View Post
Well for starters it has more delay than an old amstrad computer?.. using this include makes giving/taking damage much much better.
Hmm, what else?

I'm just curious, obviously I always make my own system but I want to know what all this really 'fixes'. (I wanna make sure I'm not missing anything lol)


Re: lagcomp.inc - Fixed lagcomp response - Killa[DGZ] - 26.04.2017

Quote:
Originally Posted by Kar
View Post
Hmm, what else?

I'm just curious, obviously I always make my own system but I want to know what all this really 'fixes'. (I wanna make sure I'm not missing anything lol)
For me it fixes the issue where sometimes you shoot someone, an you shoot an shoot an shoot and blood is pissin out of the target but you can't seem to take much health from them until you get really close.

In general, it just makes damage much more synchronized, even my players commented on how fast it was to react when they shot/hit someone an also the bugs :P


Re: lagcomp.inc - Fixed lagcomp response - Yashas - 26.04.2017

Quote:
Originally Posted by Killa[DGZ]
View Post
For me it fixes the issue where sometimes you shoot someone, an you shoot an shoot an shoot and blood is pissin out of the target but you can't seem to take much health from them until you get really close.

In general, it just makes damage much more synchronized, even my players commented on how fast it was to react when they shot/hit someone an also the bugs :P
Your last comment sounds impossible. Can you elaborate on what you meant?

@Gammix What's the bug with lagcomp?

The only issue I am aware of is that some non-desynced players become bulletproof and none of the callbacks get called (I am not even sure if this has to do something with my code; it happens to 4-5 players a day and it is not possible to reproduce it in an empty gamemode).


Re: lagcomp.inc - Fixed lagcomp response - Killa[DGZ] - 26.04.2017

Quote:
Originally Posted by Yashas
View Post
Your last comment sounds impossible. Can you elaborate on what you meant?

@Gammix What's the bug with lagcomp?

The only issue I am aware of is that some non-desynced players become bulletproof and none of the callbacks get called (I am not even sure if this has to do something with my code; it happens to 4-5 players a day and it is not possible to reproduce it in an empty gamemode).
Never heard of that issue Yashas, not sure how thats came about.. be really tricky to fix too I imagine.

In short, the include from my understanding sets everyone to the same team (enables friendly fire) and uses the damage callbacks to negate from the victims health accordingly.

Not sure why, but it is alot quicker and persistant to update than the normal way.. just try it.


Re: lagcomp.inc - Fixed lagcomp response - Yashas - 26.04.2017

Quote:
Originally Posted by Killa[DGZ]
View Post
Never heard of that issue Yashas, not sure how thats came about.. be really tricky to fix too I imagine.

In short, the include from my understanding sets everyone to the same team (enables friendly fire) and uses the damage callbacks to negate from the victims health accordingly.
I am not sure about the bulletproof issue. It happens so rarely that it makes it very difficult to reproduce it in an empty gamemode. I would need to invite hundreds of players to play in am empty gamemode and wait for it happen.

The other issue is callbacks aren't called always and there are an awful lot of bug reports of this in the Bug Reports section already.

What did it really fix?

Quote:
Originally Posted by Killa[DGZ]
View Post
Not sure why, but it is alot quicker and persistant to update than the normal way.. just try it.
Where did you test?


Re: lagcomp.inc - Fixed lagcomp response - Gammix - 26.04.2017

The issue with lagcomp is that it first of all doesnt work with melee weapons, when you try to hit someone but it doesnt call OnPlayerTakeDamage, you have to predict like in old days where to fire. Best is that you go in an empty gamemode and test the way "Testing" section in main post says (two times, one without this include and one with).
Ofcourse wait till i fix the bug(s).

Secondally lets say you have a deagle and you fire 7 bullets, its likely that all the shots will register OnPlayerTakeDamage (all the shots were hit) but they will call OnPlayerWeaponShot and OnPlayerGiveDamage. So that part is fixed in this.

So the reason why i set all to same team is so that player cannot damage a player with any weapon, neglect OnPlayerTakeDamage completely for player hit player. So i manually handle damage system in OnPlayerGiveDamage which makes it protective from hacks too.