Pivity

Question about damage types and resistance

Last read Never
#1

Greetings,

is it possible to make certain jobs resistent to certain damage types?

(for example: Biohazard playermodel with gasmask resistent to DMG_ACID, DMG_POSION, etc..)

Thanks!

#2

Not sure but I imagine this might be a start:

https://wiki.facepunch.com/gmod/GM:EntityTakeDamage


No longer sure how you check for jobs on DarkRP using lua nowadays, but I doubt it will be too hard.

Not at all sure on how to check what kind of damage the player has received.


I don't have Gmod installed and haven't worked with lua in more than a year, but maybe this is a starting point for you and someone else can correct me:


https://pastebin.com/WqV9XW0y

(Nevermind the formatting, I had to add a few comments I guess)

#3

Yeah

https://wiki.facepunch.com/gmod/GM:EntityTakeDamage


In the CTakeDamageInfo class, you can use the GetDamageType() method to get it's damage type


Something like this.

Used pastebin because gms code formatting made me lose the will to live.



Explanation of a bit of everything you need to know, code is untested, dont expect it to work.

https://pastebin.com/5mFZ43R

(return true not false, I didn't check the wiki prior to this so I assumed it would be false, thank you gmod for the many inconsistencies)

#4

Thanks for the replies. I feel like im doin something wrong, in which folder should i put the code?

Im not exactly the best at this kind of stuff. :D

#5

It's a serverside hook, so the code must be executed on the server.

Refer to the wiki ig

#6

create a new lua file under lua/autorun/server

#8

Alright, the https://pastebin.com/WqV9XW0y code is working just fine!

Thank you Momox and BullyHunter for your help!

Stay safe!

#9

You're welcome and I'm actually suprised that worked lol

Users viewing this thread
Nobody