|
| 1 | +--- |
| 2 | +import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro'; |
| 3 | +
|
| 4 | +import { getSeeAlsoLinksFromList } from '@src/utils/general'; |
| 5 | +import SeeAlsoSection from '@src/components/SeeAlsoSection.astro'; |
| 6 | +
|
| 7 | +import { Code } from '@astrojs/starlight/components'; |
| 8 | +
|
| 9 | +const damageTypesById: Record<number, { type: string; info?: string }> = { |
| 10 | + 19: { type: "Rocket", info: "Actual damage type when damaged from a rocket launcher" }, |
| 11 | + 37: { type: "Burnt", info: "This is used by a damage by fire, even when the fire is created by a rocket explosion or a molotov" }, |
| 12 | + 49: { type: "Rammed" }, |
| 13 | + 50: { type: "Ranover", info: "This is also called when damaged because of helicopter blades" }, |
| 14 | + 51: { type: "Explosion", info: "This may sometimes also be used at an indirect damage through an exploding rocket" }, |
| 15 | + 52: { type: "Driveby", info: "This is NOT used for a driveby kill with e.g. the 'realdriveby' resource" }, |
| 16 | + 53: { type: "Drowned" }, |
| 17 | + 54: { type: "Fall" }, |
| 18 | + 55: { type: "Unknown", info: "No known information about this damage type" }, |
| 19 | + 56: { type: "Melee", info: "Seems to be never called (?); for an actual melee damage, the fist weapon ID (0) is used" }, |
| 20 | + 57: { type: "Weapon", info: "Seems to be never called (?)" }, |
| 21 | + 59: { type: "Tank Grenade" }, |
| 22 | + 63: { type: "Blown", info: "Actual damage type when dying in a vehicle explosion" } |
| 23 | +}; |
| 24 | +
|
| 25 | +
|
| 26 | +let luaTable = `local damageTypes = {\n`; |
| 27 | +Object.entries(damageTypesById).forEach(([id, { type, info }], index) => { |
| 28 | + luaTable += `\t[${id}] = "${type}"`; |
| 29 | + if (info) { |
| 30 | + luaTable += `, -- ${info}`; |
| 31 | + } |
| 32 | + luaTable += `\n`; |
| 33 | +}); |
| 34 | +luaTable += `}`; |
| 35 | +
|
| 36 | +--- |
| 37 | +<StarlightPage frontmatter={{ |
| 38 | + template: 'doc', |
| 39 | + title: 'Damage Types', |
| 40 | + tableOfContents: false, |
| 41 | +}}> |
| 42 | + <p>The following damage types are used by events like <a href="/reference/onPlayerDamage">onPlayerDamage</a> or <a href="/reference/onPlayerWasted">onPlayerWasted</a> for the weapon argument to describe the reason, why a ped has been damaged or died.</p> |
| 43 | + |
| 44 | + <p>When a player was shot by a weapon, the respective weapon ID is the damage type ID. The weapon IDs can be found <a href="/reference/ID_Lists/Weapons">here</a>.</p> |
| 45 | + <table> |
| 46 | + <thead> |
| 47 | + <tr> |
| 48 | + <th>ID</th> |
| 49 | + <th>Damage Type</th> |
| 50 | + <th>Additional Info</th> |
| 51 | + </tr> |
| 52 | + </thead> |
| 53 | + <tbody> |
| 54 | + {Object.entries(damageTypesById).map(([id, { type, info }]) => ( |
| 55 | + <tr> |
| 56 | + <td>{id}</td> |
| 57 | + <td>{type}</td> |
| 58 | + <td>{info || ''}</td> |
| 59 | + </tr> |
| 60 | + ))} |
| 61 | + </tbody> |
| 62 | + </table> |
| 63 | + <h4>Damage types in a Lua table: :</h4> |
| 64 | + |
| 65 | + <Code lang="lua" code={luaTable}/> |
| 66 | + |
| 67 | + <SeeAlsoSection seeAlsoLinks={getSeeAlsoLinksFromList([ |
| 68 | + 'reference:ID_Lists', |
| 69 | + ])} currentId='' /> |
| 70 | +</StarlightPage> |
0 commit comments