Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Guest Message by DevFuse
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. 194. 195. 196. 197. 198. 199. 200. 201. 202. 203. 204. 205. 206. 207. 208. 209. 210. 211. 212. 213. 214. 215. 216. 217. 218. 219. 220. 221. 222. 223. 224. 225. 226. 227. 228. 229. 230. 231. 232. 233. 234. 235. 236. 237. 238. 239. 240. 241. 242. 243. 244. 245. 246. 247. 248. 249. 250. 251. 252. 253. 254. 255. 256. 257. 258. 259. 260. 261. 262. 263. 264. 265. 266. 267. 268. 269. 270. 271. 272. 273. 274. 275. 276. 277. 278. 279. 280. 281. 282. 283. 284. 285. 286. 287. 288. 289. 290. 291. 292. 293. 294. 295. 296. 297. 298. 299. 300. 301. 302. 303. 304. 305. 306. 307. 308. 309. 310. 311. 312. 313. 314. 315. 316. 317. 318. 319. 320. 321. 322. 323. 324. 325. 326. 327. 328. 329. 330. 331. 332. 333. 334. 335. 336. 337. 338. 339. 340. 341. 342. 343. 344. 345. 346. 347. 348. 349. 350. 351. 352. 353. 354. 355. 356. 357. 358. 359. 360. 361. 362. 363. 364. 365. 366. 367. 368. 369. 370. 371. 372. 373. 374. 375. 376. 377. 378. 379. 380. 381. 382. 383. 384. 385. 386. 387. 388. 389. 390. 391. 392. 393. 394. 395. 396. 397. 398. 399. 400. 401. 402. 403. 404. 405. 406. 407. 408. 409. 410. 411. 412. 413. 414. 415. 416. 417. 418. 419. 420. 421. 422. 423. 424. 425. 426. 427. 428. 429. 430. 431. 432. 433. 434. 435. 436. 437. 438. 439. 440. 441. 442. 443. 444. 445. 446. 447. 448. 449. 450. 451. 452. 453. 454. 455. 456. 457. 458. 459.
#define TE_EXPLOSION 3 #define TE_EXPLFLAG_NONE 0 #define TE_SMOKE 5 #define TE_BLOODSPRITE 115 #define TE_BLOODSTREAM 101 #define TE_MODEL 106 #define TE_WORLDDECAL 116 #define SEQ_IDLE 0 #define SEQ_FIDGET 1 #define SEQ_RELOAD 2 #define SEQ_FIRE 3 #define BA_AMMO 3 #define BA_DMGRAD 250 // NOTE: damagradius is not affected by walls #define BA_MAXDMG 150 #define BA_RLDTM 2.0 // in seconds #define BA_TRLTM 30 // roughly 3 seconds #define BA_VELCT 700 // custom velocity //this function is more internal than external, it makes giving a bazooka happen in one line instead of 15 public give_item_bazooka(id,ammo,sound){ hasBazooka[id] = true // the plugin now knows they have a bazooka Munni[id] = ammo //set ammunition CanShoot[id] = true // they can shoot now if(mode[id]==1){ mode[id]=2; } check_model(id); // refresh model if(sound){ //audio notification emit_sound(id, CHAN_ITEM, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) } set_task(0.1,"forceslot3",id+3482); } public forceslot3(id){ id-=3482; if(!IsPlayer(id) || !is_user_alive(id))return PLUGIN_CONTINUE; client_cmd(id,"slot3"); check_model(id); bazooka_showmodename(id); ammo_hud(id, 0) ammo_hud(id, 1) // refresh hud info return PLUGIN_CONTINUE; } //this replaces the dropped bomb model with the rpg model public forward_setmodel(entity , model[]) { if(!is_valid_ent(entity)){ return FMRES_IGNORED; } new id=pev(entity,pev_owner); if(IsPlayer(id) && is_user_alive(id) && equali(model, "models/w_knife.mdl") && hasBazooka[id] && mode[id]!=1){ entity_set_model(entity , "models/w_rpg.mdl"); return FMRES_SUPERCEDE; } return FMRES_IGNORED; } public player_bazooka(id){ new attack = get_user_button(id) & IN_ATTACK new oldattack = get_user_oldbutton(id) & IN_ATTACK new attack2 = get_user_button(id) & IN_ATTACK2 new oldattack2 = get_user_oldbutton(id) & IN_ATTACK2 new reload = get_user_button(id) & IN_RELOAD new oldreload = get_user_oldbutton(id) & IN_RELOAD if (attack && !oldattack && mode[id]!=1) { if(CanShoot[id] && (user_controll[id]==0)){ fire_rocket(id); } } else if((reload && !oldreload) || (attack2 && !oldattack2 && mode[id]!=1)){ check_model(id) switch(mode[id]){ case 1: { mode[id] = 2 ammo_hud(id, 0) ammo_hud(id, 1) check_model(id) emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) client_print(id, print_center, "Bazooka") set_animation(id,SEQ_FIDGET); } case 2: { mode[id] = 3 ammo_hud(id, 0) ammo_hud(id, 1) check_model(id) emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) emit_sound(id, CHAN_WEAPON, "items/nvg_on.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) client_print(id, print_center, "Bazooka samonaprowadzajaca") set_animation(id,SEQ_FIDGET); } case 3: { mode[id] = 1 ammo_hud(id, 0) ammo_hud(id, 1) check_model(id) emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) emit_sound(id, CHAN_WEAPON, "items/gunpickup4.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) client_print(id, print_center, "Noz") set_animation(id,SEQ_FIDGET); }/* case 4: { mode[id] = 1 ammo_hud(id, 0) ammo_hud(id, 1) check_model(id) emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) client_print(id, print_center, "Bazooka sterowana przez gracza") set_animation(id,SEQ_FIDGET); }*/ } } else if(mode[id]!=1){ return FMRES_SUPERCEDE; } return FMRES_IGNORED; } public bazooka_showmodename(id){ switch(mode[id]){ case 1: client_print(id, print_center, "Noz"); case 2: client_print(id, print_center, "Bazooka"); case 3: client_print(id, print_center, "Bazooka samonaprowadzajaca"); case 4: client_print(id, print_center, "Bazooka sterowana przez gracza"); } } //this gets rid of the backpack model for bomb carriers, i left it in for reference /*public forward_setmodel(entity, model[]) { if (!is_valid_ent(entity)) { return FMRES_IGNORED } if (equal(model, "models/w_backpack.mdl")) { client_print(0, print_center, "") new ClassName[32] entity_get_string(entity, EV_SZ_classname, ClassName, 31) if (equal(ClassName, "weaponbox")) { remove_entity(entity) return FMRES_SUPERCEDE } } return FMRES_IGNORED }*/ /*Notes: Around here i was trying to make the rpg animations work seq_animation[id] sets the animation sequence for a specific id the animation numbers for the bazooka are listed as constants at the top and are as follows: SEQ_IDLE 0 SEQ_FIDGET 1 SEQ_RELOAD 2 SEQ_FIRE 3 i don't remember how well i got animations to work, but i remember that at best, you had to be holding the fire button for the fire animation to work */ public rpg_reloaddone(data[]) { new id=data[0]; CanShoot[id]=true; set_animation(id,SEQ_IDLE); } public fire_rocket(id){ ammo_hud(id, 0) ammo_hud(id, 1) //those two functions above effectively refresh the custom hud info for the bazooka CanShoot[id] = false set_animation(id,SEQ_FIRE); new data[1] data[0] = id //Note: since rtime must be a float i made the cvar a whole number for convienence //but then i added 0.0 to make it a float for later set_task(BA_RLDTM, "rpg_reloaddone", id+9477, data, 1) //when can i shoot again? set_animation(id, SEQ_RELOAD); if (Munni[id] <= 0) { //no ammo, do empty click emit_sound(id, CHAN_WEAPON, "weapons/dryfire1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) return PLUGIN_HANDLED; } else { //ammo, start up the math //don't touch most of this unless you know your vectors and ents new Float:StartOrigin[3], Float:Angle[3] new PlayerOrigin[3] get_user_origin(id, PlayerOrigin, 1) StartOrigin[0] = float(PlayerOrigin[0]) StartOrigin[1] = float(PlayerOrigin[1]) StartOrigin[2] = float(PlayerOrigin[2]) entity_get_vector(id, EV_VEC_v_angle, Angle) Angle[0] = Angle[0] * -1.0 new RocketEnt = create_entity("info_target") entity_set_string(RocketEnt, EV_SZ_classname, "rpgrocket") entity_set_model(RocketEnt, "models/rpgrocket.mdl") entity_set_origin(RocketEnt, StartOrigin) entity_set_vector(RocketEnt, EV_VEC_angles, Angle) new Float:MinBox[3] = {-1.0, -1.0, -1.0} new Float:MaxBox[3] = {1.0, 1.0, 1.0} entity_set_vector(RocketEnt, EV_VEC_mins, MinBox) entity_set_vector(RocketEnt, EV_VEC_maxs, MaxBox) entity_set_int(RocketEnt, EV_INT_solid, 2) entity_set_int(RocketEnt, EV_INT_movetype, 5) entity_set_edict(RocketEnt, EV_ENT_owner, id) new Float:Velocity[3] new myvelocity = BA_VELCT //custom velocity VelocityByAim(id, myvelocity, Velocity) entity_set_vector(RocketEnt, EV_VEC_velocity, Velocity) emit_sound(RocketEnt, CHAN_WEAPON, "weapons/rocketfire1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) emit_sound(RocketEnt, CHAN_VOICE, "weapons/nuke_fly.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) ammo_hud(id, 0) Munni[id]-- if(Munni[id]<=0){ hasBazooka[id]=false; emit_sound(id, CHAN_WEAPON, "weapons/dryfire1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) check_model(id); ammo_hud(id, 0); client_cmd(id,"slot3; slot2; slot1"); } ammo_hud(id, 1) //here we do the trail colors new CsTeams:iTeam =cs_get_user_team(id) new trailtime =BA_TRLTM switch(iTeam) { case CS_TEAM_T: { //if team T color=red message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(22) write_short(RocketEnt) write_short(rocketsmoke) write_byte(trailtime) write_byte(3) write_byte(255) write_byte(0) write_byte(0) write_byte(255) message_end() } case CS_TEAM_CT: { // if team CT color=blue message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(22) write_short(RocketEnt) write_short(rocketsmoke) write_byte(trailtime) write_byte(3) write_byte(0) write_byte(0) write_byte(255) write_byte(255) message_end() } } if (mode[id] == 3) { //mmmmm heat-seeking new info[1] info[0] = RocketEnt set_task(1.0, "find_and_follow", 0, info, 1) } else if (mode[id] == 4) { //user-guided entity_set_int(RocketEnt, EV_INT_rendermode, 1) attach_view(id, RocketEnt) wb_setview(id, RocketEnt) user_controll[id] = RocketEnt } return PLUGIN_HANDLED } return PLUGIN_HANDLED } public find_and_follow(info[]) { new RocketEnt = info[0] new Float:shortestDist = 10000.0 new nearestPlayer = 0 if (is_valid_ent(RocketEnt)) { new players[32], count get_players(players, count) for (new i = 0; i < count; i++) { if (is_user_alive(players[i]) && (entity_get_edict(RocketEnt, EV_ENT_owner) != players[i]) && (get_user_team(players[i]) != get_user_team(entity_get_edict(RocketEnt, EV_ENT_owner)))) { new Float:PlayerOrigin[3], Float:RocketOrigin[3] entity_get_vector(players[i], EV_VEC_origin, PlayerOrigin) entity_get_vector(RocketEnt, EV_VEC_origin, RocketOrigin) new Float:distance = vector_distance(PlayerOrigin, RocketOrigin) if (distance <= shortestDist) { shortestDist = distance nearestPlayer = players[i] } } } } if (nearestPlayer > 0) { new data[2] data[0] = RocketEnt data[1] = nearestPlayer set_task(0.1, "follow_and_catch", RocketEnt, data, 2, "b") } else { pfn_touch(RocketEnt, 0) } } public follow_and_catch(data[]) { new RocketEnt = data[0] new target = data[1] new myvelocity = BA_VELCT if (is_user_alive(target) && is_valid_ent(RocketEnt)) { entity_set_follow(RocketEnt, target, (myvelocity+0.0)) new Float:Velocity[3] new Float:NewAngle[3] entity_get_vector(RocketEnt, EV_VEC_velocity, Velocity) vector_to_angle(Velocity, NewAngle) entity_set_vector(RocketEnt, EV_VEC_angles, NewAngle) } else { remove_task(RocketEnt) new info[1] info[0] = RocketEnt set_task(0.1, "find_and_follow", 0, data, 1) } } public pfn_touch(ptr, ptd){ new ClassName[32] new ClassNameptd[32] //here i grab the classname of each item for debugging and advanced collisions later if ((ptr > 0) && is_valid_ent(ptr)) { entity_get_string(ptr, EV_SZ_classname, ClassName, 31) } if ((ptd > 0) && is_valid_ent(ptd)) { entity_get_string(ptd, EV_SZ_classname, ClassNameptd, 31) } if (equal(ClassName, "rpgrocket")) { remove_task(ptr) new Float:EndOrigin[3]//x,y,z entity_get_vector(ptr, EV_VEC_origin, EndOrigin) message_begin( MSG_BROADCAST, SVC_TEMPENTITY) // Explosion write_byte(TE_EXPLOSION) write_coord(floatround(EndOrigin[0])) write_coord(floatround(EndOrigin[1])) write_coord(floatround(EndOrigin[2])+5) write_short(g_sModelIndexFireball) write_byte(random_num(0,20) + 20) write_byte(12) // framerate write_byte(TE_EXPLFLAG_NONE) message_end() message_begin(MSG_BROADCAST, SVC_TEMPENTITY) // Smoke write_byte(TE_SMOKE) write_coord(floatround(EndOrigin[0])) write_coord(floatround(EndOrigin[1])) write_coord(floatround(EndOrigin[2])+15) write_short(g_sModelIndexSmoke) write_byte(60) write_byte(10) message_end() /*message_begin(MSG_BROADCAST,SVC_TEMPENTITY) // Explosion Decal write_byte(28) //grenade explotion mark write_coord(floatround(EndOrigin[0])) write_coord(floatround(EndOrigin[1])) write_coord(floatround(EndOrigin[2])) write_short(spr_blood_spray) write_short(spr_blood_drop) write_byte(229) // color index write_byte(15) // size message_end()*/ new maxdamage = BA_MAXDMG new damageradius = BA_DMGRAD if (equal(ClassNameptd, "func_breakable")) { //new Float:ptrhealth = entity_get_float(ptr,EV_FL_health); //new Float:ptdhealth = entity_get_float(ptd,EV_FL_health); //DEBUG INFO //client_print(0, print_console, "Entity ptr health is: %i",ptrhealth) //client_print(0, print_console, "Entity ptd health is: %i",ptdhealth) //entity_set_float(ptr,EV_FL_health,100.0); //i don't remember why this is here //the functions below break ANY breakables and kill the rocket //and when i say ANY breakables i mean ANY breakables //it will destroy even trigger only breakables, bad for mapmakers force_use(ptr,ptd) remove_task(ptr) } /*Notes: Here i tried to make it so that if a breakable entity was within the damage radius it would recieve it's share of damage this is very experimental as I couldn't get it to work after two or three days of tinkering */ /*if (equal(ClassNameptd, "func_breakable")) { client_print(0, print_console, "got classname %s",ClassNameptd) new Float:orig1[3], origin1[3],NonFloatEndOrigin[3] entity_get_vector(ptd, EV_VEC_origin, orig1) for(new a = 0; a < 3; a++) { origin1[a] = floatround(orig1[a]) } for(new a = 0; a < 3; a++) { NonFloatEndOrigin[a] = floatround(EndOrigin[a]) } new ptddistance = get_distance(origin1, NonFloatEndOrigin) client_print(0, print_console, "got distance %i",ptddistance) if (ptddistance <= damageradius) { client_print(0, print_console, "is in damage radius") new damage = maxdamage - floatround(floatmul(float(maxdamage), floatdiv(float(ptddistance), float(damageradius)))) if (damage > 25) { client_print(0, print_console, "damage > 25") force_use(ptr,ptd) remove_task(ptr) } else { client_print(0, print_console, "damage < 25") remove_task(ptr) } } return PLUGIN_CONTINUE }*/ new PlayerPos[3], distance, damage for (new i = 1; i < 32; i++) { if (is_user_alive(i) == 1) { get_user_origin(i, PlayerPos) new NonFloatEndOrigin[3] for(new a = 0; a < 3; a++) { NonFloatEndOrigin[a] = floatround(EndOrigin[a]) } distance = get_distance(PlayerPos, NonFloatEndOrigin) if (distance <= damageradius) { // Screenshake Radius message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenShake"), {0,0,0}, i) // Shake Screen write_short(1<<14) write_short(1<<14) write_short(1<<14) message_end() damage = maxdamage - floatround(floatmul(float(maxdamage), floatdiv(float(distance), float(damageradius)))) new attacker = entity_get_edict(ptr, EV_ENT_owner) if (!get_user_godmode(i)) { if (get_user_team(attacker