Lovinglife Posted March 23, 2010 Share Posted March 23, 2010 STAFF NOTE (2020): This topic is severely outdated and contains false information, it was written and answerred long before MTA implemented the anti-cheat it currently has, at all. Hi all... I have known that there is an anticheat in mta client (i guess), id like to know more about this...is a resource of similar? or just a client feat? And i know that if u try to refill ur hp (this doesnt work with armor ) to 100 u get kicked...well there is a way to edit this and show in chat and log(output etc..) This ac works only for what i typed above? Link to comment
karlis Posted March 23, 2010 Share Posted March 23, 2010 i think they arent integrated, but you can make them yourself with events system example: --serverside forbiddenweapons={38,36} addEventHandler("onPlayerWeaponSwitch",getRootElement(),function(_,newweapon) for k,v in pairs("forbiddenweapons") do if v==newweapon then banPlayer(source,"[anticheat]cheating with "..forbiddenweapons[k]) --be sure you disabled they in freeroam first... end end end) for hp kick you need check players hp every second for example, and check how did you get hp, for that u need some events both on pickup use and on custom script hp refill Link to comment
Gamesnert Posted March 23, 2010 Share Posted March 23, 2010 There is some kind of anti-cheat in MTA. The only times I've seen it though was at the times it was broken, and kicked players for random reasons. It does try to detect some cheats, but by far not all of them. Hacks not protected by AC: (for as far as I know) Projectile spam (creating rockets in some weird way) Airbrake Vehicle invincibility Godmode Things like flying car cheats etc All of these are possible to block with scripting, in theory. Like for projectile spam, onClientProjectileCreation should trigger. For flying car cheats, you should be able to use isWorldSpecialPropertyEnabled. For airbrake you could use a velocity check etc. etc. etc. @ karlis: What kind of hack is your example supposed to protect the server from? For as far as I know, weapon hacks aren't synced in MTA. (I could be wrong, but I'm pretty sure I'm not) Therefore, neither the server nor other players will see the hacker with a gun in his hands. The only problem I can come up with are rocket launchers, because projectiles are synced. However, banning the entire weapon is not really an effective way to get rid of this, because as I said before, it's not likely the server would even know the player has the weapon. So you'd only ban player which have got it in a proper way. There should rather be a check when a rocket was launched, to see if the player should actually be able to launch a rocket. Link to comment
Gamesnert Posted March 23, 2010 Share Posted March 23, 2010 0.o didnt know, sory No need to apologize. I'm just pointing out that perhaps it might only bring in an undesired effect. Link to comment
PacMan Posted March 24, 2010 Share Posted March 24, 2010 Today I specifically tested cheats on weapons, if you give weapon to itself that you previously was not, you some time can go with it and then write Network Trobleshoting, while from it is impossible to kill. If you use client-side functions for get weapons/ammo write cheats ammo values, server-side functions write that you have weaponID 0 and writes number of ammo that you gave yourself. If script give to you any weapon, you can safely give yourself any number ammo, this number will be synchronized with the server, you can go with the infinite weapons and all kills. Link to comment
Buffalo Posted March 24, 2010 Share Posted March 24, 2010 There is 'broken hp anti cheat, that might kick you if you use cancelEvent() on onClientPlayerDamage, i had to stop my project because of this. Although it happened me only when i used it to cease damage from zombies. Of course it might be that some other resource did same thing and it somehow got messy.. Link to comment
DakiLLa Posted March 24, 2010 Share Posted March 24, 2010 that might kick you if you use cancelEvent() on onClientPlayerDamage And also it kicks you if you change your health inside this event :\ Link to comment
Lovinglife Posted March 26, 2010 Author Share Posted March 26, 2010 Uhm i see, thanks for ur replies...time ago i saw a topic i and i got this script addEventHandler ("onPlayerDamage", getRootElement (), local playerHealth = getElementHealth ( source ) if playerHealth > 100 then kickPlayer ( player kickedPlayer, [ player responsiblePlayer, string reason = "Don't hack your Health!" ] ) end ) *i rly dont remember if it was > o = 100...* But this is not working(>)...i might need smth, a timer or smth that checks ur HP and if u got >100hp u get caught on chat...and if u get armor >0 too, btw ill try to do it too Regards Lovinglife Link to comment
PacMan Posted March 26, 2010 Share Posted March 26, 2010 When godmode this event does not work. Link to comment
Lovinglife Posted March 26, 2010 Author Share Posted March 26, 2010 When godmode this event does not work. mmm Link to comment
Jason_Gregory Posted March 26, 2010 Share Posted March 26, 2010 Take a look at your kick Command... addEventHandler("OnPlayerDamage", getRootElement (), function(attacker, attackerweapon, bodypart, loss) if(getElementHealth(source) > 100 or getElementHealth(source) == 100 or loss == 0)then kickPlayer ( source, "Server", "Hp-Hax0r" ) end ) Link to comment
Gamesnert Posted March 26, 2010 Share Posted March 26, 2010 Take a look at your kick Command... Take a look at yours... Anyhow, as PacMan said, onPlayerDamage most likely won't work, because for as far as I know, health hacks put health back to the original value as fast as you get the damage, or disable it altogether. Could be wrong, but it makes sense in a way if you ask me. The only thing you can really do is adding some checks client-side to see if the player was hit by a bullet. If health doesn't go down, then there's most likely something like hacks stopping damage. I think onClientPlayerWeaponFire should do the trick. If the client player was the hit element and health didn't drop, there sure as hell should be something going on. Link to comment
Maccer. Posted March 27, 2010 Share Posted March 27, 2010 onPlayerDamage doesn't register when you have god-mode, along with other events. I think wasEventCancelled() can fix this though. But there's so much events in MTA, there's all sorts of ways to detect it. Link to comment
robhol Posted March 27, 2010 Share Posted March 27, 2010 i think they arent integrated, but you can make them yourself with events systemexample: --serverside forbiddenweapons={38,36} addEventHandler("onPlayerWeaponSwitch",getRootElement(),function(_,newweapon) for k,v in pairs("forbiddenweapons") do if v==newweapon then banPlayer(source,"[anticheat]cheating with "..forbiddenweapons[k]) --be sure you disabled they in freeroam first... end end end) for hp kick you need check players hp every second for example, and check how did you get hp, for that u need some events both on pickup use and on custom script hp refill I think it would be nice if you learned Lua before posting example code that's just... dead wrong. It's nice you want to help, but broken example code just doesn't help very much at all. Link to comment
Mr.Hankey Posted March 27, 2010 Share Posted March 27, 2010 Take a look at your kick Command... Take a look at yours... Anyhow, as PacMan said, onPlayerDamage most likely won't work, because for as far as I know, health hacks put health back to the original value as fast as you get the damage, or disable it altogether. Could be wrong, but it makes sense in a way if you ask me. The only thing you can really do is adding some checks client-side to see if the player was hit by a bullet. If health doesn't go down, then there's most likely something like hacks stopping damage. I think onClientPlayerWeaponFire should do the trick. If the client player was the hit element and health didn't drop, there sure as hell should be something going on. The problem with this method is that the hit position doesn't take bullet spreading into account so it'll always show the point where the player aimed instead of the actual bullet impact point. Link to comment
Jason_Gregory Posted March 27, 2010 Share Posted March 27, 2010 (edited) If I understand aright the Event (onPlayerDamage) is fired once after Damaging the Playersource and s0beit puts Health back AFTER he lost Health (the Event was fired), with something like a Timer (yeah it should have a ~1/4 Sec delay). Why not slowing down the Event with sleep ? (Im not sure about that, cause i´ve never seen the sleep for Debian) c_Seconds = 0.5 addEventHandler("onPlayerDamage", getRootElement (), function(attacker, attackerweapon, bodypart, loss) os.execute("sleep " .. tonumber(c_Seconds)) if(getElementHealth(source) > 100 or getElementHealth(source) == 100 or loss == 0)then kickPlayer ( source, "Server", "Hp-Hax0r" ) end ) Edited March 27, 2010 by Guest Link to comment
Gamesnert Posted March 27, 2010 Share Posted March 27, 2010 os.execute doesn't exist in MTA. And please look at your event handler, it wouldn't work anyway. Link to comment
Jason_Gregory Posted March 27, 2010 Share Posted March 27, 2010 Allright (omfg i hate caseSensitive ), it wouldn´t be better calculating the new Players Health, Starting a Timer and Checking him after ~3/4 Second again ? local p_Health = {} function Hphack(attacker, attackerweapon, bodypart, loss) p_Health[source] = getElementHealth(source) - loss setTimer(Hphacksleep, 750, 1, source) end addEventHandler("onPlayerDamage", getRootElement (), Hphack) function Hphacksleep(playa) if(getElementHealth(playa) ~= p_Health[playa])then outputChatBox("Hacker...", playa) end end Should work Link to comment
50p Posted March 27, 2010 Share Posted March 27, 2010 Allright (omfg i hate caseSensitive ),it wouldn´t be better calculating the new Players Health, Starting a Timer and Checking him after ~3/4 Second again ? local p_Health = {} function Hphack(attacker, attackerweapon, bodypart, loss) p_Health[source] = getElementHealth(source) - loss setTimer(Hphacksleep, 750, 1, source) end addEventHandler("onPlayerDamage", getRootElement (), Hphack) function Hphacksleep(playa) if(getElementHealth(playa) ~= p_Health[playa])then outputChatBox("Hacker...", playa) end end Should work Why do you keep using onPlayerDamage in those scripts if you know this event is not triggered on god-children? It has to be client-side hack to detect godmode. Link to comment
Jason_Gregory Posted March 27, 2010 Share Posted March 27, 2010 Hm...not triggered for god-Children. Thx, my English fails miserable . Im still confusing i thought the Serverside Event is fired synchronistic with the Clientside Damage Event but like Gamesnerd said it makes sense Link to comment
Mr.Hankey Posted March 28, 2010 Share Posted March 28, 2010 onClientPlayerDamage doesn't get triggered too since the healthhack stops gta's internal damage calculation completly. Link to comment
DakiLLa Posted March 28, 2010 Share Posted March 28, 2010 I guess, there is no any proper way to make a normal anti-cheat system, except of fully rewriting damage and gun shots... Link to comment
Lovinglife Posted March 30, 2010 Author Share Posted March 30, 2010 Hey guys, hi all....ive read ur posts...btw i think those codes are not working (just bcuz ive read all posts..included the ones which say codes are wrong...) Ive been thinkin a way to do it...1)such as using a timer and every seconds the code controls if ur hp are more than 100 and if ur armor is more than 0... and 2)antiammohax? I ve seen if u try to hax ur granade ammos u success...while if u got 1 gran and u throw it...then u get 100 gran from s*beit, well those 100 arent synched (tested)...but if u spawn with 1 gran and u add 100 u got 101 gran...x.x....Is there a way to avoid ammohax? im taking a look on mta wiki...if u got any idea please say it Regards Lovinglife Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now