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
Wklejka 1rftm6760ui dodana przez Cichy Zefir, 20.09.2016 07:26
Laser Mina
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. 460. 461. 462. 463. 464. 465. 466. 467. 468. 469. 470. 471. 472. 473. 474. 475. 476. 477. 478. 479. 480. 481. 482. 483. 484. 485. 486. 487. 488.
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <fakemeta> #include <xs> #include <zombieplague.inc> #include <hamsandwich> #include <colorchat> #include <zp50_core> #include <zp50_items> #include <zp50_ammopacks> #include <zp50_class_survivor> #include <zp50_class_sniper> #include <zp50_gamemodes> native set_user_xp(id, amount) native get_user_xp(id) native sprawdz_misje(id) native dodaj_ile_juz(id, ile) #if defined UL_MONEY_SUPPORT #include <money_ul> #endif #if AMXX_VERSION_NUM < 180 #assert AMX Mod X v1.8.0 or greater library required! #endif #define PLUGIN "Laser/Tripmine Entity" #define VERSION "2.3" #define AUTHOR "SandStriker" #define RemoveEntity(%1) engfunc(EngFunc_RemoveEntity,%1) //#define ACCESSLEVEL ADMIN_LEVEL_H #define TASK_PLANT 30100 #define TASK_RESET 15500 #define TASK_RELEASE 15900 #define LASERMINE_TEAM pev_iuser1//EV_INT_iuser1 #define LASERMINE_OWNER pev_iuser2 //EV_INT_iuser3 #define LASERMINE_STEP pev_iuser3 #define LASERMINE_HITING pev_iuser4 #define LASERMINE_COUNT pev_fuser1 #define LASERMINE_POWERUP pev_fuser2 #define LASERMINE_BEAMTHINK pev_fuser3 #define LASERMINE_BEAMENDPOINT pev_vuser1 #define MAX_MINES 10 #define MODE_LASERMINE 0 #define OFFSET_TEAM 114 #define OFFSET_MONEY 115 #define OFFSET_DEATH 444 #define cs_get_user_team(%1) CsTeams:get_offset_value(%1,OFFSET_TEAM) #define cs_get_user_deaths(%1) get_offset_value(%1,OFFSET_DEATH) #define cs_get_user_money(%1) get_offset_value(%1,OFFSET_MONEY) #define cs_set_user_money(%1,%2) set_offset_value(%1,OFFSET_MONEY,%2) ////////////// Define ZP EXTRA! ////////////////////// new const g_item_name[] = { "LaserMines" } const g_item_lmines = 8 new g_itemid_lminas //new id //new proban; ////////////////////////////////////////////////////// enum CsTeams { CS_TEAM_UNASSIGNED = 0, CS_TEAM_T = 1, CS_TEAM_CT = 2, CS_TEAM_SPECTATOR = 3 }; enum tripmine_e { TRIPMINE_IDLE1 = 0, TRIPMINE_IDLE2, TRIPMINE_ARM1, TRIPMINE_ARM2, TRIPMINE_FIDGET, TRIPMINE_HOLSTER, TRIPMINE_DRAW, TRIPMINE_WORLD, TRIPMINE_GROUND, }; enum { POWERUP_THINK, BEAMBREAK_THINK, EXPLOSE_THINK }; enum { POWERUP_SOUND, ACTIVATE_SOUND, STOP_SOUND }; new const ENT_MODELS[] = "models/v_tripmine.mdl", ENT_SOUND1[] = "weapons/mine_deploy.wav", ENT_SOUND2[] = "weapons/mine_charge.wav", ENT_SOUND3[] = "weapons/mine_activate.wav", ENT_SOUND4[] = "debris/beamstart9.wav", ENT_SOUND5[] = "items/gunpickup2.wav", ENT_SOUND6[] = "debris/bustglass1.wav", ENT_SOUND7[] = "debris/bustglass2.wav", ENT_SPRITE1[] = "sprites/laserbeam.spr", ENT_SPRITE2[] = "sprites/zerogxplode.spr"; new const ENT_CLASS_NAME[] = "lasermine", gSnarkClassName[] = "wpn_snark", //ENT_CLASS_NAME2[] = "info_target", ENT_CLASS_NAME3[] = "func_breakable"; new const CHATTAG[] = "[ZP]", //STR_MINEDETNATED[] = "Your mine has detonated.", //STR_MINEDETNATED2[] = "detonated your mine.", STR_NOTACTIVE[] = "Lasermines are not currently active.", STR_DONTHAVEMINE[] = "You do not have LaserMines.", //STR_CANTDEPLOY[] = "Your team can't deploying lasermine!", STR_MAXDEPLOY[] = "Maximum mines have been deployed.", STR_MANYPPL[] = "Too many ppl on your team...", STR_PLANTWALL[] = "You have to plant the LaserMine on the wall!", STR_REF[] = "Refer to a lasermine rule with this server. say 'lasermine'", STR_CBT[] = "Your Zombie! Can't buy and deploying lasermine!", STR_CANTBUY[] = "Can't buying this server.", STR_HAVEMAX[] = "You have a maximum lasermine.", STR_NOMONEY[] = "You don't have enough money to buy a lasermine! ($", STR_NEEDED[] = "needed)", STR_DELAY[] = "To use lasermines, you have to wait until the first zombie", //STR_SECONDS[] = "seconds.", STR_BOUGHT[] = "You earned a LaserMine!. You can plant with the key 'P'", STR_BOUGHT2[] = "You earned a LaserMine!. You can plant with +use key", STR_BOUGHT3[] = "You earned a LaserMine!. You can plant with bind +setlaser", //STR_STATE[] = "LaserMine Ammo:", STR_NOACCESS[] = "You have no access to this command."; new g_EntMine; new beam, boom new g_LENABLE,g_LFMONEY,g_LAMMO,g_LDMG, g_LTMAX,g_LCOST,g_LHEALTH,g_LMODE,g_LRADIUS,g_LRDMG,g_LFF,g_LCBT,g_BINDMODE; new /*g_LDELAY*, g_LTHINK,*/g_LVISIBLE, g_LSTAMMO,g_LACCESS,g_LGLOW,g_LDMGMODE,g_LCLMODE,g_LCBRIGHT,g_LDSEC,g_LCMDMODE,g_LBUYMODE,g_REWARDAP,g_REWARDXP; new g_dcount[33],/*g_nowtime,*/g_MaxPL new bool:g_settinglaser[33] new g_msgDeathMsg,g_msgScoreInfo,g_msgDamage,g_msgMoney; new Float:plspeed[33] new plsetting[33] new g_havemine[33]; new g_deployed[33]; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); register_plugin("[ZP] Extra: LaserMines", "1.4", "LARP") g_itemid_lminas = zp_items_register(g_item_name, g_item_lmines) // Add your code here... register_clcmd("say /lm","buy_lmines"); register_clcmd("say /lasermine","buy_lmines"); register_clcmd("+setlaser","CreateLaserMine_Progress_b"); register_clcmd("-setlaser","StopCreateLaserMine"); register_clcmd("+dellaser","ReturnLaserMine_Progress"); register_clcmd("-dellaser","StopReturnLaserMine"); //register_clcmd("say","say_lasermine"); g_LENABLE = register_cvar("zp_ltm","1"); g_BINDMODE = register_cvar("zp_ltm_bind","1"); //Auto bind P Key! g_LACCESS = register_cvar("zp_ltm_acs","0"); //0 all, 1 admin g_LMODE = register_cvar("zp_ltm_mode","1"); //0 lasermine, 1 tripmine g_LAMMO = register_cvar("zp_ltm_ammo","99999"); g_LDMG = register_cvar("zp_ltm_dmg","1000"); //laser hit dmg g_LCOST = register_cvar("zp_ltm_cost","0"); g_LFMONEY = register_cvar("zp_ltm_fragmoney","0"); g_LHEALTH = register_cvar("zp_ltm_health","500"); g_LTMAX = register_cvar("zp_ltm_teammax","22"); g_LRADIUS = register_cvar("zp_ltm_radius","800"); g_LRDMG = register_cvar("zp_ltm_rdmg","1200"); //radius damage g_LFF = register_cvar("zp_ltm_ff","0"); g_LCBT = register_cvar("zp_ltm_team","ALL"); //NO MODIFY!! g_LBUYMODE = register_cvar("zp_ltm_buymode","1"); /******************** NONONONO!!! **************************/ //g_LDELAY = register_cvar("zp_delay",""); //NO CHANGE!!! /******************** NONONONO!!! **************************/ //g_LTHINK = register_cvar("amx_ltm_think","0.01") g_LVISIBLE = register_cvar("zp_ltm_line","1"); g_LGLOW = register_cvar("zp_ltm_glow","0"); g_LCBRIGHT = register_cvar("zp_ltm_bright","100"); //laser line brightness. g_LCLMODE = register_cvar("zp_ltm_color","0"); //0 is team color,1 is green g_LDMGMODE = register_cvar("zp_ltm_ldmgmode","0"); //0 - frame dmg, 1 - once dmg, 2 - 1 second dmg g_LDSEC = register_cvar("zp_ltm_ldmgseconds","1"); //mode 2 only, damage / seconds. default 1 (sec) g_LSTAMMO = register_cvar("zp_ltm_startammo","1"); g_LCMDMODE = register_cvar("zp_ltm_cmdmode","1"); //0 is +USE key, 1 is bind, 2 is each. g_REWARDAP = register_cvar("zp_ltm_cmdaward_ap","2"); //nagroda za zniszczenie lm (AP) g_REWARDXP = register_cvar("zp_ltm_cmdaward_xp","10"); //nagroda za zniszczenie lm (XP) //g_ACT = register_cvar("zp_ltm_act","0"); register_event("DeathMsg", "DeathEvent", "a"); register_event("CurWeapon", "standing", "be", "1=1"); register_event("ResetHUD", "delaycount", "a"); register_event("ResetHUD", "newround", "b"); register_event("Damage","CutDeploy_onDamage","b"); g_msgDeathMsg = get_user_msgid("DeathMsg"); g_msgScoreInfo = get_user_msgid("ScoreInfo"); g_msgDamage = get_user_msgid("Damage"); //g_msgStatusText = get_user_msgid("StatusText"); g_msgMoney = get_user_msgid("Money"); // -- Forward. register_forward(FM_Think, "ltm_Think" ); register_forward(FM_PlayerPostThink, "ltm_PostThink" ); register_forward(FM_PlayerPreThink, "ltm_PreThink"); RegisterHam(Ham_TakeDamage, "func_breakable", "fwHamTakeDamage" ); } public plugin_precache() { precache_sound(ENT_SOUND1); precache_sound(ENT_SOUND2); precache_sound(ENT_SOUND3); precache_sound(ENT_SOUND4); precache_sound(ENT_SOUND5); precache_sound(ENT_SOUND6); precache_sound(ENT_SOUND7); precache_model(ENT_MODELS); beam = precache_model(ENT_SPRITE1); boom = precache_model(ENT_SPRITE2); return PLUGIN_CONTINUE; } public fwHamTakeDamage( this, idinflictor, idattacker, Float:damage, damagebits ) { static classname[ 20 ]; pev( this, pev_classname, classname, 19 ); if( ( equal( classname, ENT_CLASS_NAME )) && (!zp_core_is_zombie(idattacker)/* || idattacker == pev(this, pev_owner)*/)) return HAM_SUPERCEDE; if( ( equal( classname, ENT_CLASS_NAME )) && zp_core_is_zombie(idattacker)){ // new damage2 = hp_dzialka - floatround(damage) // change_health(this,-35,pev(ent,pev_iuser1),"grenade") // ExecuteHam(Ham_TakeDamage, this, 0, idattacker, damage, 1); new hp_miny hp_miny = pev(this, pev_health) client_print(idattacker, print_center, "HP Miny: %d", hp_miny) if(damage >= hp_miny) { zp_ammopacks_set(idattacker, zp_ammopacks_get(idattacker) + get_pcvar_num(g_REWARDAP)) set_user_xp(idattacker, get_user_xp(idattacker) + get_pcvar_num(g_REWARDXP)) // client_print(idattacker, print_chat, "Dostales %i AP za zniszczenie LaserMiny", g_REWARD); new name[32] get_user_name(idattacker, name, 31) ColorChat(0,GREEN,"[ZM EXP]^x03 %s^x01 dostal^x04 %i^x01 AP oraz^x04 %i^x01 XP za zniszczenie LaserMiny", name, get_pcvar_num(g_REWARDAP), get_pcvar_num(g_REWARDXP)); if(sprawdz_misje(idattacker) == 43) dodaj_ile_juz(idattacker, 1) } else if(hp_miny-damage > 0) client_print(idattacker, print_center, "HP Miny: %d", hp_miny-floatround(damage)); } return HAM_IGNORED; } public plugin_modules() { require_module("fakemeta"); require_module("cstrike"); //require_module("fun") } public plugin_cfg() { g_EntMine = engfunc(EngFunc_AllocString,ENT_CLASS_NAME3); arrayset(g_havemine,0,sizeof(g_havemine)); arrayset(g_deployed,0,sizeof(g_deployed)); g_MaxPL = get_maxplayers(); new file[64]; get_localinfo("amxx_configsdir",file,63); format(file, 63, "%s/ltm_cvars.cfg", file); if(file_exists(file)) server_cmd("exec %s", file), server_exec(); } public delaycount(id) { g_dcount[id] = floatround(get_gametime()); } /*bool:CheckTime(id) { g_nowtime = floatround(get_gametime()) - g_dcount[id]; if(g_nowtime >= get_pcvar_num(g_LDELAY)+ 5) //Check time of ZP_DELAY return true; return false; }*/ public CreateLaserMine_Progress_b(id) { /*if (!CheckTime(id)) { client_print(id,print_chat, "%s %s",CHATTAG,STR_DELAY); return false; }*/ if (!zp_has_round_started()) { client_print(id,print_chat, "%s %s",CHATTAG,STR_DELAY); return false; } if (!zp_get_user_zombie(id)) { if(get_pcvar_num(g_LCMDMODE) != 0) CreateLaserMine_Progress(id); return PLUGIN_HANDLED; } //client_print(id, print_chat, "[ZP] The zombies can not use this command"); return false; } public CreateLaserMine_Progress(id) { if (!CreateCheck(id)) return PLUGIN_HANDLED; g_settinglaser[id] = true; message_begin( MSG_ONE, 108, {0,0,0}, id ); write_byte(1); write_byte(0); message_end(); set_task(1.2, "Spawn", (TASK_PLANT + id)); return PLUGIN_HANDLED; } public ReturnLaserMine_Progress(id) { if (!ReturnCheck(id)) return PLUGIN_HANDLED; g_settinglaser[id] = true; message_begin( MSG_ONE, 108, {0,0,0}, id ); write_byte(3); write_byte(0); message_end(); set_task(3.0, "ReturnMine", (TASK_RELEASE + id)); return PLUGIN_HANDLED; } public StopCreateLaserMine(id) { DeleteTask(id); message_begin(MSG_ONE, 108, {0,0,0}, id); write_byte(0); write_byte(0); message_end(); return PLUGIN_HANDLED; } public StopReturnLaserMine(id) { DeleteTask(id); message_begin(MSG_ONE, 108, {0,0,0}, id); write_byte(0); write_byte(0); message_end(); return PLUGIN_HANDLED; } public ReturnMine(id) { id -= TASK_RELEASE; new tgt,body,Float:vo[3],Float:to[3]; get_user_aiming(id,tgt,body); if(!pev_valid(tgt)) return; pev(id,pev_origin,vo); pev(tgt,pev_origin,to); if(get_distance_f(vo,to) > 70.0) return; new EntityName[32]; pev(tgt, pev_classname, EntityName, 31); if(!equal(EntityName, ENT_CLASS_NAME)) return; if(pev(tgt,LASERMINE_OWNER) != id) return; RemoveEntity(tgt); g_havemine[id] ++; g_deployed[id] --; emit_sound(id, CHAN_ITEM, ENT_SOUND5, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) //ShowAmmo(id) return; } public Spawn( id ) { id -= TASK_PLANT // motor new i_Ent = engfunc(EngFunc_CreateNamedEntity,g_EntMine); if(!i_Ent) { client_print(id,print_chat,"[ZP] Can't Create Entity"); return PLUGIN_HANDLED_MAIN; } set_pev(i_Ent,pev_classname,ENT_CLASS_NAME); engfunc(EngFunc_SetModel,i_Ent,ENT_MODELS); set_pev(i_Ent,pev_solid,SOLID_NOT); set_pev(i_Ent,pev_movetype,MOVETYPE_FLY); set_pev(i_Ent,pev_frame,0); set_pev(i_Ent,pev_body,3); set_pev(i_Ent,pev_sequence,TRIPMINE_WORLD); set_pev(i_Ent,pev_framerate,0); set_pev(i_Ent,pev_takedamage,DAMAGE_YES); set_pev(i_Ent,pev_dmg,100.0); set_user_health(i_Ent,get_pcvar_num(g_LHEALTH)); new Float:vOrigin[3]; new Float:vNewOrigin[3],Float:vNormal[3],Float:vTraceDirection[3], Float:vTraceEnd[3],Float:vEntAngles[3]; pev( id, pev_origin, vOrigin ); velocity_by_aim( id, 128, vTraceDirection ); xs_vec_add( vTraceDirection, vOrigin, vTraceEnd ); engfunc( EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0 ); new Float:fFraction; get_tr2( 0, TR_flFraction, fFraction ); // -- We hit something! if ( fFraction < 1.0 ) { // -- Save results to be used later. get_tr2( 0, TR_vecEndPos, vTraceEnd ); get_tr2( 0, TR_vecPlaneNormal, vNormal ); } xs_vec_mul_scalar( vNormal, 8.0, vNormal ); xs_vec_add( vTraceEnd, vNormal, vNewOrigin ); engfunc(EngFunc_SetSize, i_Ent, Float:{ -4.0, -4.0, -4.0 }, Float:{ 4.0, 4.0, 4.0 } ); engfunc(EngFunc_SetOrigin, i_Ent, vNewOrigin ); // -- Rotate tripmine. vector_to_angle(vNormal,vEntAngles ); set_pev(i_Ent,pev_angles,vEntAngles ); // -- Calculate laser end origin. new Float:vBeamEnd[3], Float:vTracedBeamEnd[3]; xs_vec_mul_scalar(vNormal, 8192.0, vNormal ); xs_v
Dodanych wklejek: 10848
Powered By (Pav32) Pastebin © 2011