weapon-config.inc 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. // Weapon-Config by Slice.
  2. // Modified for NG:RP's script by Jingles.
  3. enum E_SHOT_INFO {
  4. acl_Tick,
  5. acl_Weapon,
  6. acl_HitType,
  7. acl_HitId,
  8. acl_Hits,
  9. Float:acl_fPos[3],
  10. Float:acl_fTargetPos[3],
  11. Float:acl_fOrigin[3],
  12. Float:acl_fHitPos[3],
  13. Float:acl_fDistance,
  14. bool:acl_Valid,
  15. }
  16. static ac_LagCompMode;
  17. static ac_LastUpdate[MAX_PLAYERS] = {-1, ...};
  18. static ac_RejectedHitsIdx[MAX_PLAYERS];
  19. static ac_iCBugFreeze[MAX_PLAYERS];
  20. static ac_MaxShootRateSamples = 5;
  21. //static ac_MaxHitRateSamples = 5;
  22. static arrLastBulletData[MAX_PLAYERS][E_SHOT_INFO];
  23. static ac_LastBulletIdx[MAX_PLAYERS];
  24. static ac_LastBulletTicks[MAX_PLAYERS][10];
  25. static ac_LastBulletWeapons[MAX_PLAYERS][10];
  26. static ac_LastExplosive[MAX_PLAYERS];
  27. static ac_LastHitTicks[MAX_PLAYERS][10];
  28. static ac_LastHitWeapons[MAX_PLAYERS][10];
  29. static ac_LastHitIdx[MAX_PLAYERS];
  30. static Float:ac_PlayerMaxHealth[MAX_PLAYERS] = {100.0, ...};
  31. //static Float:ac_PlayerMaxArmour[MAX_PLAYERS] = {100.0, ...};
  32. //static ac_LastSentHealth[MAX_PLAYERS];
  33. //static ac_LastSentArmour[MAX_PLAYERS];
  34. //static bool:ac_DamageArmourToggle[2] = {false, ...};
  35. //static Float:ac_DamageDoneHealth[MAX_PLAYERS];
  36. //static Float:ac_DamageDoneArmour[MAX_PLAYERS];
  37. // The fastest possible gap between weapon shots in milliseconds
  38. static ac_MaxWeaponShootRate[] = {
  39. 250, // 0 - Fist
  40. 250, // 1 - Brass knuckles
  41. 250, // 2 - Golf club
  42. 250, // 3 - Nitestick
  43. 250, // 4 - Knife
  44. 250, // 5 - Bat
  45. 250, // 6 - Shovel
  46. 250, // 7 - Pool cue
  47. 250, // 8 - Katana
  48. 30, // 9 - Chainsaw
  49. 250, // 10 - Dildo
  50. 250, // 11 - Dildo 2
  51. 250, // 12 - Vibrator
  52. 250, // 13 - Vibrator 2
  53. 250, // 14 - Flowers
  54. 250, // 15 - Cane
  55. 0, // 16 - Grenade
  56. 0, // 17 - Teargas
  57. 0, // 18 - Molotov
  58. 20, // 19 - Vehicle M4 (custom)
  59. 20, // 20 - Vehicle minigun (custom)
  60. 0, // 21
  61. 160, // 22 - Colt 45
  62. 120, // 23 - Silenced
  63. 120, // 24 - Deagle
  64. 800, // 25 - Shotgun
  65. 120, // 26 - Sawed-off
  66. 120, // 27 - Spas
  67. 50, // 28 - UZI
  68. 90, // 29 - MP5
  69. 90, // 30 - AK47
  70. 90, // 31 - M4
  71. 70, // 32 - Tec9
  72. 800, // 33 - Cuntgun
  73. 900, // 34 - Sniper
  74. 0, // 35 - Rocket launcher
  75. 0, // 36 - Heatseeker
  76. 0, // 37 - Flamethrower
  77. 20, // 38 - Minigun
  78. 0, // 39 - Satchel
  79. 0, // 40 - Detonator
  80. 10, // 41 - Spraycan
  81. 10, // 42 - Fire extinguisher
  82. 0, // 43 - Camera
  83. 0, // 44 - Night vision
  84. 0, // 45 - Infrared
  85. 0, // 46 - Parachute
  86. 0, // 47 - Fake pistol
  87. 400 // 48 - Pistol whip (custom)
  88. };
  89. // Max continuous shots.
  90. static ac_MaxWeaponContShots[] = {
  91. 0, // 0 - Fist
  92. 0, // 1 - Brass knuckles
  93. 0, // 2 - Golf club
  94. 0, // 3 - Nitestick
  95. 0, // 4 - Knife
  96. 0, // 5 - Bat
  97. 0, // 6 - Shovel
  98. 0, // 7 - Pool cue
  99. 0, // 8 - Katana
  100. 0, // 9 - Chainsaw
  101. 0, // 10 - Dildo
  102. 0, // 11 - Dildo 2
  103. 0, // 12 - Vibrator
  104. 0, // 13 - Vibrator 2
  105. 0, // 14 - Flowers
  106. 0, // 15 - Cane
  107. 0, // 16 - Grenade
  108. 0, // 17 - Teargas
  109. 0, // 18 - Molotov
  110. 0, // 19 - Vehicle M4 (custom)
  111. 0, // 20 - Vehicle minigun (custom)
  112. 0, // 21
  113. 10, // 22 - Colt 45
  114. 10, // 23 - Silenced
  115. 10, // 24 - Deagle
  116. 10, // 25 - Shotgun
  117. 20, // 26 - Sawed-off
  118. 20, // 27 - Spas
  119. 30, // 28 - UZI
  120. 30, // 29 - MP5
  121. 30, // 30 - AK47
  122. 30, // 31 - M4
  123. 30, // 32 - Tec9
  124. 10, // 33 - Cuntgun
  125. 10, // 34 - Sniper
  126. 0, // 35 - Rocket launcher
  127. 0, // 36 - Heatseeker
  128. 0, // 37 - Flamethrower
  129. 400, // 38 - Minigun
  130. 0, // 39 - Satchel
  131. 0, // 40 - Detonator
  132. 0, // 41 - Spraycan
  133. 0, // 42 - Fire extinguisher
  134. 0, // 43 - Camera
  135. 0, // 44 - Night vision
  136. 0, // 45 - Infrared
  137. 0, // 46 - Parachute
  138. 0, // 47 - Fake pistol
  139. 0 // 48 - Pistol whip (custom)
  140. };
  141. // Whether the damage is applied directly to health (1) or is distributed between health and armour (0), and whether this rule applies only to the torso (1) or not (0)
  142. /*
  143. static ac_DamageArmour[][2] = {
  144. {0, 0}, // 0 - Fist
  145. {0, 0}, // 1 - Brass knuckles
  146. {0, 0}, // 2 - Golf club
  147. {0, 0}, // 3 - Nitestick
  148. {0, 0}, // 4 - Knife
  149. {0, 0}, // 5 - Bat
  150. {0, 0}, // 6 - Shovel
  151. {0, 0}, // 7 - Pool cue
  152. {0, 0}, // 8 - Katana
  153. {0, 0}, // 9 - Chainsaw
  154. {0, 0}, // 10 - Dildo
  155. {0, 0}, // 11 - Dildo 2
  156. {0, 0}, // 12 - Vibrator
  157. {0, 0}, // 13 - Vibrator 2
  158. {0, 0}, // 14 - Flowers
  159. {0, 0}, // 15 - Cane
  160. {0, 0}, // 16 - Grenade
  161. {0, 0}, // 17 - Teargas
  162. {0, 0}, // 18 - Molotov
  163. {1, 1}, // 19 - Vehicle M4 (custom)
  164. {1, 1}, // 20 - Vehicle minigun (custom)
  165. {1, 0}, // 21
  166. {1, 1}, // 22 - Colt 45
  167. {1, 1}, // 23 - Silenced
  168. {1, 1}, // 24 - Deagle
  169. {1, 1}, // 25 - Shotgun
  170. {1, 1}, // 26 - Sawed-off
  171. {1, 1}, // 27 - Spas
  172. {1, 1}, // 28 - UZI
  173. {1, 1}, // 29 - MP5
  174. {1, 1}, // 30 - AK47
  175. {1, 1}, // 31 - M4
  176. {1, 1}, // 32 - Tec9
  177. {1, 1}, // 33 - Cuntgun
  178. {1, 1}, // 34 - Sniper
  179. {0, 0}, // 35 - Rocket launcher
  180. {0, 0}, // 36 - Heatseeker
  181. {0, 0}, // 37 - Flamethrower
  182. {1, 1}, // 38 - Minigun
  183. {0, 0}, // 39 - Satchel
  184. {0, 0}, // 40 - Detonator
  185. {0, 0}, // 41 - Spraycan
  186. {0, 0}, // 42 - Fire extinguisher
  187. {1, 0}, // 43 - Camera
  188. {1, 0}, // 44 - Night vision
  189. {1, 0}, // 45 - Infrared
  190. {1, 0}, // 46 - Parachute
  191. {1, 0}, // 47 - Fake pistol
  192. {0, 0}, // 48 - Pistol whip (custom)
  193. {0, 0}, // 49 - Vehicle
  194. {0, 1}, // 50 - Helicopter blades
  195. {0, 0}, // 51 - Explosion
  196. {0, 0}, // 52 - Car park
  197. {0, 0}, // 53 - Drowning
  198. {0, 0} // 54 - Splat
  199. };
  200. */
  201. // Weapons allowed in OnPlayerGiveDamage
  202. static const ac_ValidDamageGiven[] = {
  203. 1, // 0 - Fist
  204. 1, // 1 - Brass knuckles
  205. 1, // 2 - Golf club
  206. 1, // 3 - Nitestick
  207. 1, // 4 - Knife
  208. 1, // 5 - Bat
  209. 1, // 6 - Shovel
  210. 1, // 7 - Pool cue
  211. 1, // 8 - Katana
  212. 1, // 9 - Chainsaw
  213. 1, // 10 - Dildo
  214. 1, // 11 - Dildo 2
  215. 1, // 12 - Vibrator
  216. 1, // 13 - Vibrator 2
  217. 1, // 14 - Flowers
  218. 1, // 15 - Cane
  219. 0, // 16 - Grenade
  220. 0, // 17 - Teargas
  221. 0, // 18 - Molotov
  222. 0, // 19 - Vehicle M4 (custom)
  223. 0, // 20 - Vehicle minigun
  224. 0, // 21
  225. 1, // 22 - Colt 45
  226. 1, // 23 - Silenced
  227. 1, // 24 - Deagle
  228. 1, // 25 - Shotgun
  229. 1, // 26 - Sawed-off
  230. 1, // 27 - Spas
  231. 1, // 28 - UZI
  232. 1, // 29 - MP5
  233. 1, // 30 - AK47
  234. 1, // 31 - M4
  235. 1, // 32 - Tec9
  236. 1, // 33 - Cuntgun
  237. 1, // 34 - Sniper
  238. 0, // 35 - Rocket launcher
  239. 0, // 36 - Heatseeker
  240. 0, // 37 - Flamethrower
  241. 1, // 38 - Minigun
  242. 0, // 39 - Satchel
  243. 0, // 40 - Detonator
  244. 1, // 41 - Spraycan
  245. 1, // 42 - Fire extinguisher
  246. 0, // 43 - Camera
  247. 0, // 44 - Night vision
  248. 0, // 45 - Infrared
  249. 1 // 46 - Parachute
  250. };
  251. // Weapons allowed in OnPlayerTakeDamage
  252. // 2 = valid in both OnPlayerGiveDamage and OnPlayerTakeDamage
  253. static const ac_ValidDamageTaken[] = {
  254. 1, // 0 - Fist
  255. 1, // 1 - Brass knuckles
  256. 1, // 2 - Golf club
  257. 1, // 3 - Nitestick
  258. 1, // 4 - Knife
  259. 1, // 5 - Bat
  260. 1, // 6 - Shovel
  261. 1, // 7 - Pool cue
  262. 1, // 8 - Katana
  263. 1, // 9 - Chainsaw
  264. 1, // 10 - Dildo
  265. 1, // 11 - Dildo 2
  266. 1, // 12 - Vibrator
  267. 1, // 13 - Vibrator 2
  268. 1, // 14 - Flowers
  269. 1, // 15 - Cane
  270. 0, // 16 - Grenade
  271. 0, // 17 - Teargas
  272. 0, // 18 - Molotov
  273. 0, // 19 - Vehicle M4 (custom)
  274. 0, // 20 - Vehicle minigun (custom)
  275. 0, // 21
  276. 1, // 22 - Colt 45
  277. 1, // 23 - Silenced
  278. 1, // 24 - Deagle
  279. 1, // 25 - Shotgun
  280. 1, // 26 - Sawed-off
  281. 1, // 27 - Spas
  282. 1, // 28 - UZI
  283. 1, // 29 - MP5
  284. 1, // 30 - AK47
  285. 1, // 31 - M4
  286. 1, // 32 - Tec9
  287. 1, // 33 - Cuntgun
  288. 1, // 34 - Sniper
  289. 0, // 35 - Rocket launcher
  290. 0, // 36 - Heatseeker
  291. 2, // 37 - Flamethrower
  292. 1, // 38 - Minigun
  293. 0, // 39 - Satchel
  294. 0, // 40 - Detonator
  295. 1, // 41 - Spraycan
  296. 1, // 42 - Fire extinguisher
  297. 0, // 43 - Camera
  298. 0, // 44 - Night vision
  299. 0, // 45 - Infrared
  300. 1, // 46 - Parachute
  301. 0, // 47 - Fake pistol
  302. 0, // 48 - Pistol whip (custom)
  303. 2, // 49 - Vehicle
  304. 2, // 50 - Helicopter blades
  305. 2, // 51 - Explosion
  306. 0, // 52 - Car park (custom)
  307. 2, // 53 - Drowning
  308. 2 // 54 - Splat
  309. };
  310. //#assert DAMAGE_TYPE_MULTIPLIER == 0
  311. //#assert DAMAGE_TYPE_STATIC == 1
  312. // Whether the damage is multiplied by the given/taken value (0) or always the same value (1)
  313. /*
  314. static ac_DamageType[] = {
  315. 0, // 0 - Fist
  316. 0, // 1 - Brass knuckles
  317. 0, // 2 - Golf club
  318. 0, // 3 - Nitestick
  319. 0, // 4 - Knife
  320. 0, // 5 - Bat
  321. 0, // 6 - Shovel
  322. 0, // 7 - Pool cue
  323. 0, // 8 - Katana
  324. 0, // 9 - Chainsaw
  325. 0, // 10 - Dildo
  326. 0, // 11 - Dildo 2
  327. 0, // 12 - Vibrator
  328. 0, // 13 - Vibrator 2
  329. 0, // 14 - Flowers
  330. 0, // 15 - Cane
  331. 0, // 16 - Grenade
  332. 1, // 17 - Teargas
  333. 0, // 18 - Molotov
  334. 1, // 19 - Vehicle M4 (custom)
  335. 1, // 20 - Vehicle minigun (custom)
  336. 0, // 21
  337. 1, // 22 - Colt 45
  338. 1, // 23 - Silenced
  339. 1, // 24 - Deagle
  340. 1, // 25 - Shotgun
  341. 1, // 26 - Sawed-off
  342. 1, // 27 - Spas
  343. 1, // 28 - UZI
  344. 1, // 29 - MP5
  345. 1, // 30 - AK47
  346. 1, // 31 - M4
  347. 1, // 32 - Tec9
  348. 1, // 33 - Cuntgun
  349. 1, // 34 - Sniper
  350. 0, // 35 - Rocket launcher
  351. 0, // 36 - Heatseeker
  352. 0, // 37 - Flamethrower
  353. 1, // 38 - Minigun
  354. 0, // 39 - Satchel
  355. 0, // 40 - Detonator
  356. 1, // 41 - Spraycan
  357. 1, // 42 - Fire extinguisher
  358. 0, // 43 - Camera
  359. 0, // 44 - Night vision
  360. 0, // 45 - Infrared
  361. 0, // 46 - Parachute
  362. 0, // 47 - Fake pistol
  363. 1, // 48 - Pistol whip (custom)
  364. 1, // 49 - Vehicle
  365. 1, // 50 - Helicopter blades
  366. 0, // 51 - Explosion
  367. 0, // 52 - Car park
  368. 0, // 53 - Drowning
  369. 0 // 54 - Splat
  370. };
  371. */
  372. // The default weapon range (from weapon.dat)
  373. // Note that due to various bugs, these can be exceeded, but
  374. // this include blocks out-of-range values.
  375. static Float:ac_WeaponRange[] = {
  376. 0.0, // 0 - Fist
  377. 0.0, // 1 - Brass knuckles
  378. 0.0, // 2 - Golf club
  379. 0.0, // 3 - Nitestick
  380. 0.0, // 4 - Knife
  381. 0.0, // 5 - Bat
  382. 0.0, // 6 - Shovel
  383. 0.0, // 7 - Pool cue
  384. 0.0, // 8 - Katana
  385. 0.0, // 9 - Chainsaw
  386. 0.0, // 10 - Dildo
  387. 0.0, // 11 - Dildo 2
  388. 0.0, // 12 - Vibrator
  389. 0.0, // 13 - Vibrator 2
  390. 0.0, // 14 - Flowers
  391. 0.0, // 15 - Cane
  392. 0.0, // 16 - Grenade
  393. 0.0, // 17 - Teargas
  394. 0.0, // 18 - Molotov
  395. 90.0, // 19 - Vehicle M4 (custom)
  396. 75.0, // 20 - Vehicle minigun (custom)
  397. 0.0, // 21
  398. 35.0, // 22 - Colt 45
  399. 35.0, // 23 - Silenced
  400. 35.0, // 24 - Deagle
  401. 40.0, // 25 - Shotgun
  402. 35.0, // 26 - Sawed-off
  403. 40.0, // 27 - Spas
  404. 35.0, // 28 - UZI
  405. 45.0, // 29 - MP5
  406. 70.0, // 30 - AK47
  407. 90.0, // 31 - M4
  408. 35.0, // 32 - Tec9
  409. 100.0, // 33 - Cuntgun
  410. 320.0, // 34 - Sniper
  411. 0.0, // 35 - Rocket launcher
  412. 0.0, // 36 - Heatseeker
  413. 0.0, // 37 - Flamethrower
  414. 75.0 // 38 - Minigun
  415. };
  416. /*
  417. enum {
  418. AC_NO_ERROR,
  419. AC_NO_ISSUER,
  420. AC_NO_DAMAGED,
  421. AC_INVALID_DAMAGE,
  422. AC_INVALID_DISTANCE
  423. }
  424. */
  425. /*
  426. enum {
  427. DAMAGE_TYPE_MULTIPLIER,
  428. DAMAGE_TYPE_STATIC,
  429. DAMAGE_TYPE_RANGE_MULTIPLIER,
  430. DAMAGE_TYPE_RANGE
  431. }
  432. */
  433. enum {
  434. HIT_NO_DAMAGEDID,
  435. HIT_INVALID_WEAPON,
  436. HIT_LAST_SHOT_INVALID,
  437. HIT_MULTIPLE_PLAYERS,
  438. HIT_MULTIPLE_PLAYERS_SHOTGUN,
  439. HIT_DYING_PLAYER,
  440. HIT_SAME_TEAM,
  441. HIT_UNSTREAMED,
  442. HIT_INVALID_HITTYPE,
  443. HIT_BEING_RESYNCED,
  444. HIT_NOT_SPAWNED,
  445. HIT_OUT_OF_RANGE,
  446. HIT_TOO_FAR_FROM_SHOT,
  447. SHOOTING_RATE_TOO_FAST,
  448. SHOOTING_RATE_TOO_FAST_MULTIPLE,
  449. HIT_RATE_TOO_FAST,
  450. HIT_RATE_TOO_FAST_MULTIPLE,
  451. HIT_KNIFE_FAILED,
  452. HIT_TOO_FAR_FROM_ORIGIN,
  453. HIT_INVALID_DAMAGE,
  454. HIT_SAME_VEHICLE,
  455. HIT_OWN_VEHICLE,
  456. HIT_INVALID_VEHICLE,
  457. HIT_DISCONNECTED
  458. }
  459. // Must be in sync with the enum above
  460. // Used in debug messages and GetRejectedHit
  461. stock const g_HitRejectReasons[][] = {
  462. "None or invalid player shot",
  463. "Invalid weapon",
  464. "Last shot invalid",
  465. "One bullet hit %d players",
  466. "Hit too many players with shotgun: %d",
  467. "Hit a dying player",
  468. "Hit a teammate",
  469. "Hit someone that can't see you (not streamed in)",
  470. "Invalid hit type: %d",
  471. "Hit while being resynced",
  472. "Hit when not spawned or dying",
  473. "Hit out of range (%f > %f)",
  474. "Hit player too far from hit position (dist %f)",
  475. "Shooting rate too fast: %d (%d samples, max %d)",
  476. "Shooting rate too fast: %d (%d samples, multiple weapons)",
  477. "Hit rate too fast: %d (%d samples, max %d)",
  478. "Hit rate too fast: %d (%d samples, multiple weapons)",
  479. "The knife kill did not sync",
  480. "Damage inflicted too far from current position (dist %f)",
  481. "Invalid weapon damage (%.4f)",
  482. "Hit a player in the same vehicle",
  483. "Hit the vehicle you're in",
  484. "Hit invalid vehicle: %d",
  485. "Hit a disconnected player ID: %d"
  486. };
  487. stock const g_WeaponName[57][59] = {
  488. {"Fist" }, {"Brass knuckles"}, {"Golf club" },
  489. {"Nightstick" }, {"Knife" }, {"Bat" },
  490. {"Shovel" }, {"Pool cue" }, {"Katana" },
  491. {"Chainsaw" }, {"Purple dildo" }, {"Dildo" },
  492. {"Vibrator" }, {"Vibrator" }, {"Flowers" },
  493. {"Cane" }, {"Grenade" }, {"Tear gas" },
  494. {"Molotov" }, {"Vehicle gun" }, {"Vehicle gun" },
  495. {"" }, {"Colt 45" }, {"Silenced pistol" },
  496. {"Deagle" }, {"Shotgun" }, {"Sawn-off shotgun" },
  497. {"Combat shotgun" }, {"Mac-10" }, {"MP5" },
  498. {"AK-47" }, {"M4" }, {"Tec-9" },
  499. {"Cuntgun" }, {"Sniper" }, {"Rocket launcher" },
  500. {"Heat seeking RPG" }, {"Flamethrower" }, {"Minigun" },
  501. {"Satchel" }, {"Detonator" }, {"Spraycan" },
  502. {"Fire extinguisher"}, {"Camera" }, {"Night vision goggles"},
  503. {"Infrared goggles" }, {"Parachute" }, {"Fake pistol" },
  504. {"Pistol whip" }, {"Vehicle" }, {"Helicopter blades" },
  505. {"Explosion" }, {"Car parking" }, {"Drowning" },
  506. {"Collision" }, {"Splat" }, {"Unknown" }
  507. };