Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.69 KB | None | 0 0
  1. /*
  2. Cvar-uri:
  3.  
  4. fmp_psycho_hp 400 - viata care o primeste psycho
  5. fmp_psycho_ap 400 - armura care o primeste psycho
  6. fmp_psycho_speed 500 - viteza care o primeste psycho
  7.  
  8.  
  9. fmp_kage_hp 300 - viata care o primeste kage
  10. fmp_kage_ap 200 - armura care o primeste kage
  11. fmp_kage_speed 1000 - viteza care o primeste kage
  12.  
  13. */
  14.  
  15.  
  16. #include < amxmodx >
  17. #include < cstrike >
  18. #include < fun >
  19. #include < engine >
  20. #include < hamsandwich >
  21. #include < fakemeta_util >
  22. #include < ColorChat >
  23.  
  24.  
  25. new const thunder_sound[] = "ambience/thunder_clap.wav";
  26. #define PLUGIN "Furien Mod Powers"
  27. #define VERSION "0.1"
  28.  
  29.  
  30. new const KageSound[ ] = "bleahhK.wav";
  31. new const PsychoSound[ ] = "bleacP.wav";
  32.  
  33. new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame;
  34.  
  35. new bool:UserIsKage[ 33 ];
  36. new bool:UserIsPsycho[ 33 ];
  37.  
  38. new cvar_hp;
  39. new cvar_ap;
  40. new cvar_speed;
  41.  
  42. new cvar_hp2;
  43. new cvar_ap2;
  44. new cvar_speed2;
  45.  
  46. new SyncHudMessage;
  47. #define SPEARGUN
  48. //native give_barlog9 ( id );
  49. native give_plasma ( id );
  50. native set_user_janus7 ( id, janus7 );
  51. native give_weapon_sfgun ( id );
  52. native set_user_ethereal ( id, ethereal );
  53. native set_user_superclaws ( id, superclaws );
  54.  
  55. #if defined SPEARGUN
  56.  
  57. // SPIRE
  58. new PRIMARY_WEAPONS_BITSUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90);
  59.  
  60.  
  61. #define SPEARGUN_WEAPONKEY 98
  62. #define weapon_speargun "weapon_galil"
  63. #define CSW_SPEARGUN CSW_GALIL
  64. #define SPEARGUN_CLASS "oicw_grenade"
  65. #define speargun_shotdelay 1.0 // Refire rate
  66. new SpearGunModel_V[] = "models/furien30_weapons/Primary/v_speargun.mdl";
  67. new SpearGunModel_P[] = "models/furien30_weapons/Primary/p_speargun.mdl";
  68. new SpearGunModel_W[] = "models/furien30_weapons/Primary/w_speargun.mdl";
  69. new SpearGunModel_S[] = "models/furien30_weapons/Primary/s_speargun.mdl";
  70. new SpearGun_Sound[][] = {
  71. "weapons/speargun_shoot1.wav",
  72. "weapons/speargun_clipin.wav",
  73. "weapons/speargun_draw.wav"
  74. };
  75. new SpearGun_Generic[][] = {
  76. "sprites/furien30_speargun.txt",
  77. "sprites/furien30_weapons/SpearGun.spr",
  78. "sprites/furien30_weapons/640hud7x.spr"
  79. };
  80.  
  81. new bool:HaveSpearGun[33], speargun_clip[33], speargun_reload[33], speargun_event, speargun_trail, speargun_explode;
  82. new speargundamage, speargunradius, speargunknockback, speargunreloadtime;
  83.  
  84. // END SPIRE
  85. #endif
  86. new g_lightning, g_smoke, SPR_ICE_BLAST, SPR_ICEEXPLODE, SPR_ICEGIB, g_light;
  87.  
  88. public plugin_cfg( )
  89. {
  90.  
  91. set_cvar_float("sv_maxspeed", 1000.0 );
  92.  
  93. }
  94.  
  95. #if defined SPEARGUN
  96. public plugin_natives ( ) {
  97.  
  98. SpearGun_Natives();
  99. }
  100.  
  101. #endif
  102. public plugin_precache( )
  103. {
  104. #if defined SPEARGUN
  105. SpearGun_Precache();
  106. register_clcmd ( "say spiregun", "give_sipregun" );
  107. #endif
  108. precache_sound( KageSound );
  109. precache_sound( PsychoSound );
  110. g_lightning = precache_model("sprites/beamvip.spr");
  111. g_light = precache_model ( "sprites/lgtning.spr" );
  112.  
  113. precache_sound ( thunder_sound );
  114. g_smoke = precache_model( "sprites/steam1.spr" );
  115. SPR_ICE_BLAST = precache_model("sprites/furien30_levelssistem/ef_shockwave.spr");
  116. SPR_ICEEXPLODE = precache_model("sprites/furien30_levelssistem/frost_explode.spr")
  117. SPR_ICEGIB = precache_model("sprites/furien30_levelssistem/frost_gib.spr")
  118. }
  119. #if defined SPEARGUN
  120. public give_sipregun ( id ) {
  121.  
  122. set_user_speargun ( id, true );
  123. }
  124. #endif
  125. public plugin_init( )
  126. {
  127. register_plugin( PLUGIN, VERSION, "Askhanar" );
  128.  
  129. cvar_hp = register_cvar( "fmp_psycho_hp", "400" );
  130. cvar_ap = register_cvar( "fmp_psycho_ap", "400" );
  131. cvar_speed = register_cvar( "fmp_psycho_speed", "450" );
  132.  
  133. cvar_hp2 = register_cvar( "fmp_kage_hp", "400" );
  134. cvar_ap2 = register_cvar( "fmp_kage_ap", "400" );
  135. cvar_speed2 = register_cvar( "fmp_kage_speed", "750" );
  136.  
  137.  
  138. RegisterHam( Ham_Spawn, "player", "Ham_PlayerSpawnPost", 1 );
  139. RegisterHam( Ham_Killed, "player", "Player_Killed" );
  140.  
  141. register_event( "DeathMsg", "evDeathMsg", "a" );
  142.  
  143. RegisterHam( Ham_Player_ResetMaxSpeed, "player", "Ham_ResetMaxSpeedPost", 1 );
  144.  
  145. SyncHudMessage = CreateHudSyncObj( );
  146. #if defined SPEARGUN
  147. SpearGun_Init ( )
  148. #endif
  149. }
  150.  
  151.  
  152. public client_connect( id )
  153. {
  154. if( is_user_bot( id ) || is_user_hltv( id ) ) return 0;
  155.  
  156. UserIsKage[ id ] = false;
  157. UserIsPsycho[ id ] = false;
  158.  
  159. client_cmd( id , "cl_sidespeed 2000" );
  160. client_cmd( id , "cl_forwardspeed 2000" );
  161. client_cmd( id , "cl_backspeed 2000" );
  162.  
  163. return 0;
  164. }
  165.  
  166. public client_disconnect( id )
  167. {
  168. if( is_user_bot( id ) || is_user_hltv( id ) ) return 0;
  169.  
  170. UserIsKage[ id ] = false;
  171. UserIsPsycho[ id ] = false;
  172.  
  173. client_cmd( id , "cl_sidespeed 2000" );
  174. client_cmd( id , "cl_forwardpeed 2000" );
  175. client_cmd( id , "cl_backspeed 2000" );
  176.  
  177. return 0;
  178. }
  179.  
  180. public Ham_PlayerSpawnPost( id )
  181. {
  182.  
  183. if( !is_user_alive( id ) || !is_user_connected( id ) ) return HAM_IGNORED;
  184.  
  185. set_user_superclaws ( id, false );
  186. #if defined SPEARGUN
  187. set_user_speargun ( id, false );
  188. #endif
  189. set_task( 0.1, "RemovePowers", id + 123 );
  190.  
  191. return HAM_IGNORED;
  192.  
  193. }
  194.  
  195. public Player_Killed ( id ) {
  196.  
  197. if ( UserIsPsycho [ id ] ) {
  198.  
  199. new Float:fOrigin[ 3 ], iOrigin[ 3 ];
  200. pev( id, pev_origin, fOrigin );
  201.  
  202. FVecIVec( fOrigin, iOrigin );
  203.  
  204. new target = id;
  205.  
  206. // get target's origin
  207. new vorigin[ 3 ], pos[ 3 ];
  208. get_user_origin( target, vorigin );
  209.  
  210.  
  211.  
  212. // modify origins
  213. vorigin[ 2 ] -= 26;
  214. pos[ 0 ] = vorigin[ 0 ] + 150;
  215. pos[ 1 ] = vorigin[ 1 ] + 150;
  216. pos[ 2 ] = vorigin[ 2 ] + 800;
  217.  
  218.  
  219.  
  220. // create lightning bolt
  221. Thunder( pos, vorigin );
  222. Thunder2 ( pos, vorigin );
  223. Thunder( pos, vorigin );
  224. Thunder2 ( pos, vorigin );
  225. Thunder( pos, vorigin );
  226. Thunder2 ( pos, vorigin );
  227. Thunder( pos, vorigin );
  228. Thunder2 ( pos, vorigin );
  229.  
  230. LightNearPlayers ( target, fOrigin );
  231.  
  232.  
  233. Smoke( vorigin, 10, 10 );
  234.  
  235.  
  236. message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id);
  237. write_short(1<<10);
  238. write_short(1<<10);
  239. write_short(0x0000);
  240. write_byte(255);
  241. write_byte(255);
  242. write_byte(255);
  243. write_byte(50);
  244. message_end();
  245. message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, target);
  246. write_short(1<<10);
  247. write_short(1<<10);
  248. write_short(0x0000);
  249. write_byte(255);
  250. write_byte(255);
  251. write_byte(255);
  252. write_byte(50);
  253. message_end();
  254. }
  255. }
  256.  
  257. Thunder( start[ 3 ], end[ 3 ] ) {
  258. message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  259. write_byte( TE_BEAMPOINTS );
  260. write_coord( start[ 0 ] );
  261. write_coord( start[ 1 ] );
  262. write_coord( start[ 2 ] );
  263. write_coord( end[ 0 ] );
  264. write_coord( end[ 1 ] );
  265. write_coord( end[ 2 ] );
  266. write_short( g_light );
  267. write_byte( 1 );
  268. write_byte( 5 );
  269. write_byte( 7 );
  270. write_byte( 80 );
  271. write_byte( 30 );
  272. write_byte( 51 ); // r
  273. write_byte( 204 ); // b
  274. write_byte( 255 ); // b
  275. write_byte( 200 );
  276. write_byte( 200 );
  277. message_end();
  278.  
  279.  
  280. message_begin( MSG_PVS, SVC_TEMPENTITY, end );
  281. write_byte( TE_SPARKS );
  282. write_coord( end[ 0 ] );
  283. write_coord( end[ 1 ]);
  284. write_coord( end[ 2 ] );
  285. message_end();
  286.  
  287.  
  288.  
  289. emit_sound( 0 ,CHAN_ITEM, thunder_sound, 1.0, ATTN_NORM, 0, PITCH_NORM );
  290. }
  291.  
  292. Thunder2( start[ 3 ], end[ 3 ] ) {
  293. message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  294. write_byte( TE_BEAMPOINTS );
  295. write_coord( start[ 0 ] );
  296. write_coord( start[ 1 ] );
  297. write_coord( start[ 2 ] );
  298. write_coord( end[ 0 ] );
  299. write_coord( end[ 1 ] );
  300. write_coord( end[ 2 ] );
  301. write_short( g_light );
  302. write_byte( 1 );
  303. write_byte( 5 );
  304. write_byte( 7 );
  305. write_byte( 20 );
  306. write_byte( 30 );
  307. write_byte( 51 ); // r
  308. write_byte( 204 ); // b
  309. write_byte( 255 ); // b
  310. write_byte( 200 );
  311. write_byte( 200 );
  312. message_end();
  313.  
  314. message_begin( MSG_PVS, SVC_TEMPENTITY, end );
  315. write_byte( TE_SPARKS );
  316. write_coord( end[ 0 ] );
  317. write_coord( end[ 1 ]);
  318. write_coord( end[ 2 ] );
  319. message_end();
  320.  
  321. }
  322.  
  323. Smoke( iorigin[ 3 ], scale, framerate ) {
  324. message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  325. write_byte( TE_SMOKE );
  326. write_coord( iorigin[ 0 ] );
  327. write_coord( iorigin[ 1 ] );
  328. write_coord( iorigin[ 2 ] );
  329. write_short( g_smoke );
  330. write_byte( scale );
  331. write_byte( framerate );
  332. message_end();
  333. }
  334.  
  335.  
  336.  
  337.  
  338. public LightNearPlayers( id, const Float:fOrigin[ 3 ] )
  339. {
  340. static iVictim;
  341. iVictim = -1;
  342.  
  343. while( ( iVictim = engfunc(EngFunc_FindEntityInSphere, iVictim, fOrigin, 300.0) ) != 0 )
  344. {
  345. if( !is_user_alive( iVictim ) )
  346. continue;
  347.  
  348.  
  349.  
  350. new Float:fVictimOrigin[ 3 ], iVictimOrigin[ 3 ];
  351. pev( id, pev_origin, fVictimOrigin );
  352.  
  353. FVecIVec( fVictimOrigin, iVictimOrigin );
  354. new Origin[3];
  355. get_user_origin(id, Origin) ;
  356.  
  357. new Float:Origin2[3];
  358. IVecFVec(Origin, Origin2);
  359.  
  360. engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, Origin2, 0)
  361. write_byte(TE_EXPLOSION)
  362. engfunc(EngFunc_WriteCoord, Origin2[0]) // x axis
  363. engfunc(EngFunc_WriteCoord, Origin2[1]) // y axis
  364. engfunc(EngFunc_WriteCoord, Origin2[2]+75) // z axis
  365. write_short(SPR_ICEEXPLODE)
  366. write_byte(22)
  367. write_byte(35)
  368. write_byte(TE_EXPLFLAG_NOSOUND)
  369. message_end()
  370.  
  371. engfunc(EngFunc_MessageBegin, MSG_BROADCAST ,SVC_TEMPENTITY, Origin2, 0)
  372. write_byte(TE_SPRITETRAIL) // TE ID
  373. engfunc(EngFunc_WriteCoord, Origin2[0]) // x axis
  374. engfunc(EngFunc_WriteCoord, Origin2[1]) // y axis
  375. engfunc(EngFunc_WriteCoord, Origin2[2]+70) // z axis
  376. engfunc(EngFunc_WriteCoord, Origin2[0]) // x axis
  377. engfunc(EngFunc_WriteCoord, Origin2[1]) // y axis
  378. engfunc(EngFunc_WriteCoord, Origin2[2]) // z axis
  379. write_short(SPR_ICEGIB) // Sprite Index
  380. write_byte(100) // Count
  381. write_byte(15) // Life
  382. write_byte(1) // Scale
  383. write_byte(50) // Velocity Along Vector
  384. write_byte(10) // Rendomness of Velocity
  385. message_end();
  386.  
  387. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin2, 0)
  388. write_byte(TE_BEAMCYLINDER) // TE id
  389. engfunc(EngFunc_WriteCoord, Origin2[0]) // x
  390. engfunc(EngFunc_WriteCoord, Origin2[1]) // y
  391. engfunc(EngFunc_WriteCoord, Origin2[2]) // z
  392. engfunc(EngFunc_WriteCoord, Origin2[0]) // x axis
  393. engfunc(EngFunc_WriteCoord, Origin2[1]) // y axis
  394. engfunc(EngFunc_WriteCoord, Origin2[2]+385.0) // z axis
  395. write_short(SPR_ICE_BLAST) // sprite
  396. write_byte(0) // startframe
  397. write_byte(0) // framerate
  398. write_byte(4) // life
  399. write_byte(60) // width
  400. write_byte(0) // noise
  401. write_byte(0) // red
  402. write_byte(100) // green
  403. write_byte(200) // blue
  404. write_byte(200) // brightness
  405. write_byte(0) // speed
  406. message_end()
  407.  
  408. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin2, 0)
  409. write_byte(TE_BEAMCYLINDER) // TE id
  410. engfunc(EngFunc_WriteCoord, Origin2[0]) // x
  411. engfunc(EngFunc_WriteCoord, Origin2[1]) // y
  412. engfunc(EngFunc_WriteCoord, Origin2[2]) // z
  413. engfunc(EngFunc_WriteCoord, Origin2[0]) // x axis
  414. engfunc(EngFunc_WriteCoord, Origin2[1]) // y axis
  415. engfunc(EngFunc_WriteCoord, Origin2[2]+470.0) // z axis
  416. write_short(SPR_ICE_BLAST) // sprite
  417. write_byte(0) // startframe
  418. write_byte(0) // framerate
  419. write_byte(4) // life
  420. write_byte(60) // width
  421. write_byte(0) // noise
  422. write_byte(0) // red
  423. write_byte(100) // green
  424. write_byte(200) // blue
  425. write_byte(200) // brightness
  426. write_byte(0) // speed
  427. message_end()
  428.  
  429. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin2, 0)
  430. write_byte(TE_BEAMCYLINDER) // TE id
  431. engfunc(EngFunc_WriteCoord, Origin2[0]) // x
  432. engfunc(EngFunc_WriteCoord, Origin2[1]) // y
  433. engfunc(EngFunc_WriteCoord, Origin2[2]) // z
  434. engfunc(EngFunc_WriteCoord, Origin2[0]) // x axis
  435. engfunc(EngFunc_WriteCoord, Origin2[1]) // y axis
  436. engfunc(EngFunc_WriteCoord, Origin2[2]+555.0) // z axis
  437. write_short(SPR_ICE_BLAST) // sprite
  438. write_byte(0) // startframe
  439. write_byte(0) // framerate
  440. write_byte(4) // life
  441. write_byte(60) // width
  442. write_byte(0) // noise
  443. write_byte(0) // red
  444. write_byte(100) // green
  445. write_byte(200) // blue
  446. write_byte(200) // brightness
  447. write_byte(0) // speed
  448. message_end()
  449.  
  450. message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
  451. write_byte(TE_DLIGHT);
  452. write_coord(Origin[0]); // x
  453. write_coord(Origin[1]); // y
  454. write_coord(Origin[2]); // z
  455. write_byte(25); // radius
  456. write_byte(0) // red
  457. write_byte(100) // green
  458. write_byte(200) // blue
  459. write_byte(8); // life
  460. write_byte(60); // decay rate
  461. message_end();
  462. CreateLightning( id, iVictim, iVictimOrigin );
  463.  
  464.  
  465.  
  466.  
  467. if ( get_user_team ( iVictim ) != get_user_team ( id ) ) {
  468.  
  469.  
  470.  
  471. new Damage = 150;
  472. if(get_user_health(iVictim) - Damage >= 1) {
  473. ExecuteHam(Ham_TakeDamage, iVictim, id, id, float(Damage), DMG_BLAST);
  474.  
  475. Create_ScreenFade(iVictim,(1<<13),(1<<14), 0x0000, 255, 255, 255, 100);
  476. Create_ScreenShake(iVictim,(1<<14),(1<<13),(1<<14));
  477. }
  478. else
  479. death_message(id, iVictim, "Chain Lightning");
  480.  
  481. }
  482. }
  483. }
  484.  
  485. stock Create_TE_SPRITETRAIL3(start[3], end[3], iSprite, count, life, scale, velocity, random ){
  486.  
  487. message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
  488. write_byte( TE_SPRITETRAIL )
  489. write_coord( start[0] ) // start position (X)
  490. write_coord( start[1] ) // start position (Y)
  491. write_coord( start[2] + 40 ) // start position (Z)
  492. write_coord( end[0] ) // end position (X)
  493. write_coord( end[1] ) // end position (Y)
  494. write_coord( end[2] ) // end position (Z)
  495. write_short( iSprite ) // sprite index
  496. write_byte( count ) // count
  497. write_byte( life) // life in 0.1's
  498. write_byte( scale) // scale in 0.1's
  499. write_byte( velocity ) // velocity along vector in 10's
  500. write_byte( random ) // randomness of velocity in 10's
  501. message_end()
  502. }
  503.  
  504. public CreateLightning( id, iVictim, iVictimOrigin[ 3 ] )
  505. {
  506. message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  507. write_byte( TE_BEAMENTS );
  508. write_short( id ); // start entity
  509. write_short( iVictim ); // end entity
  510. write_short( g_lightning ); // model
  511. write_byte( 0 ); // starting frame
  512. write_byte( 15 ); // frame rate
  513. write_byte( 15 ); // life
  514. write_byte( 80 ); // line width
  515. write_byte( 10 ); // noise amplitude
  516. write_byte( 51 ); // red
  517. write_byte( 204 ); // green
  518. write_byte( 255 ); // blue
  519. write_byte( 255 ); // brightness
  520. write_byte( 0 ); // scroll speed
  521. message_end( );
  522.  
  523. message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  524. write_byte( TE_ELIGHT );
  525. write_short( iVictim ); // entity
  526. write_coord( iVictimOrigin[0] ); // initial position
  527. write_coord( iVictimOrigin[1] ); // initial position
  528. write_coord( iVictimOrigin[2] ); // initial position
  529. write_coord( 100 ); // radius
  530. write_byte( 51 ); // red
  531. write_byte( 204 ); // green
  532. write_byte( 255 ); // blue
  533. write_byte( 15 ); // life
  534. write_coord( 0 ); // decay rate
  535. message_end( );
  536.  
  537. }
  538.  
  539. public RemovePowers( id )
  540. {
  541. id -= 123;
  542. if( !is_user_connected( id ) ) return 1;
  543.  
  544.  
  545. if( UserIsPsycho[ id ] )
  546. set_user_rendering( id );
  547.  
  548.  
  549.  
  550. if( UserIsKage[ id ] || UserIsPsycho[ id ] )
  551. set_user_armor( id, 0 );
  552.  
  553. UserIsPsycho[ id ] = false;
  554. UserIsKage[ id ] = false;
  555.  
  556. client_cmd( id, "lastinv" );
  557. client_cmd( id, "lastinv" );
  558.  
  559. return 0;
  560. }
  561.  
  562.  
  563. public SearchForPsycho( )
  564. {
  565.  
  566.  
  567. new iTerro = CountPlayers( 1 );
  568. new iCounter = CountPlayers( 2 );
  569.  
  570. if( iCounter == 1 && iTerro > 0 )
  571. {
  572.  
  573. new id = GetRemainingPlayerId( 2 );
  574. if( UserIsPsycho[ id ] ) return 1;
  575.  
  576. UserIsPsycho[ id ] = true;
  577. switch ( random_num ( 1, 5 ) ) {
  578.  
  579. case 1: give_plasma ( id );
  580.  
  581. case 2: set_user_ethereal ( id, true );
  582.  
  583. case 3: set_user_janus7 ( id, true );
  584.  
  585. case 4: give_weapon_sfgun ( id );
  586.  
  587. case 5: set_user_speargun ( id, true );
  588.  
  589. }
  590.  
  591. ColorChat( 0, RED,"^x04[AntiFurien]^x03 %s^x01 a devenit^x03 Psycho^x01 ! ", get_name( id ) );
  592. ColorChat( 0, RED,"^x04[AntiFurien]^x01 Are^x03 %d^x01 HP,^x03 %d^x01 AP,^x03 %d^x01 Speed, aveti grija !", get_pcvar_num( cvar_hp ), get_pcvar_num( cvar_ap ), get_pcvar_num( cvar_speed ) );
  593.  
  594. set_hudmessage( 0, 255, 0, -1.0, -1.0, 0, 0.0, 5.0, 0.0, 1.0, 3);
  595. ShowSyncHudMsg( 0, SyncHudMessage, "%s a devenit Psycho !^n Cea din urma salvare a omenirii !", get_name( id ) );
  596.  
  597.  
  598. set_user_maxspeed( id, float( get_pcvar_num( cvar_speed ) ) );
  599. set_user_health( id, get_pcvar_num( cvar_hp ) );
  600. set_user_armor( id, get_pcvar_num( cvar_ap ) );
  601.  
  602. set_user_rendering( id, kRenderFxGlowShell, 0, 255, 255, kRenderNormal, 25 );
  603.  
  604.  
  605. client_cmd( 0, "spk sound/%s", PsychoSound );
  606.  
  607.  
  608. }
  609.  
  610. return 0;
  611.  
  612. }
  613.  
  614. public SearchForKage( )
  615. {
  616. new iTerro = CountPlayers( 1 );
  617. new iCounter = CountPlayers( 2 );
  618.  
  619. if( iTerro == 1 && iCounter > 0 )
  620. {
  621. new id = GetRemainingPlayerId( 1 );
  622. if( UserIsKage[ id ] ) return 1;
  623.  
  624. UserIsKage[ id ] = true;
  625. set_user_superclaws ( id, true );
  626.  
  627. ColorChat( 0, RED,"^x04[Furien]^x03 %s^x01 s-a transformat in^x03 Kage^x01 ! ", get_name( id ));
  628. ColorChat( 0, RED,"^x04[Furien]^x01 Are^x03 %d^x01 HP,^x03 %d^x01 AP,^x03 %d^x01 Speed, aveti grija !", get_pcvar_num( cvar_hp2 ), get_pcvar_num( cvar_ap2 ), get_pcvar_num( cvar_speed2 ) );
  629. set_hudmessage( 0, 255, 0, -1.0, -1.0, 0, 0.0, 5.0, 0.0, 1.0, 3);
  630. ShowSyncHudMsg( 0, SyncHudMessage, "%s s-a transformat in Kage !^nSansele pamantenilor au scazut !", get_name( id ) );
  631.  
  632.  
  633. set_user_maxspeed( id, float( get_pcvar_num( cvar_speed2 ) ) );
  634. set_user_health( id, get_pcvar_num( cvar_hp2 ) );
  635. set_user_armor( id, get_pcvar_num( cvar_ap2 ) );
  636.  
  637.  
  638.  
  639. client_cmd( 0, "spk sound/%s", KageSound );
  640.  
  641. }
  642.  
  643. return 0;
  644. }
  645.  
  646. public evDeathMsg( )
  647. {
  648. if ( get_playersnum ( ) > 4 ) {
  649.  
  650. SearchForPsycho( );
  651. SearchForKage( );
  652.  
  653. }
  654.  
  655. new iKiller = read_data( 1 );
  656. new iVictim = read_data( 2 );
  657.  
  658. if( !is_user_connected( iKiller ) || !is_user_connected( iVictim ) || iKiller == iVictim ) return 1;
  659.  
  660. if( UserIsKage[ iVictim ] )
  661. {
  662. ColorChat( 0, RED, "^x04[AntiFurien]^x01 Kage^x03 %s^x01 a fost omorat de^x03 %s^x01 !",get_name( iVictim ), get_name( iKiller ) );
  663. }
  664. else if( UserIsPsycho[ iVictim ] )
  665. {
  666. ColorChat( 0, RED, "^x04[AntiFurien]^x01 Psycho^x03 %s^x01 a fost omorat de^x03 %s^x01 !",get_name( iVictim ), get_name( iKiller ) );
  667. set_user_ethereal ( iVictim, false );
  668. set_user_janus7 ( iVictim, false );
  669. }
  670.  
  671. return 0;
  672.  
  673. }
  674.  
  675.  
  676. public Ham_ResetMaxSpeedPost( id )
  677. {
  678. if( is_user_alive( id ) && is_user_connected( id ) && get_user_maxspeed(id) != 1.0 )
  679. {
  680.  
  681. new Float:flMaxSpeed;
  682. if( UserIsPsycho[ id ] )
  683. {
  684. flMaxSpeed = float( get_pcvar_num( cvar_speed ) );
  685. }
  686. if( UserIsKage[ id ] )
  687. {
  688. flMaxSpeed = float( get_pcvar_num( cvar_speed2 ) );
  689. }
  690.  
  691. if( flMaxSpeed > 0.0 )
  692. {
  693. set_pev( id, pev_maxspeed, flMaxSpeed );
  694.  
  695. // slow hack ? o_O
  696. //client_cmd( id, "cl_forwardspeed %.1f;cl_sidespeed %.1f;cl_backspeed %.1f", flMaxSpeed, flMaxSpeed, flMaxSpeed );
  697. }
  698. }
  699. }
  700.  
  701. stock CountPlayers( const Team )
  702. {
  703. new iPlayers[ 32 ];
  704. new iPlayersNum;
  705.  
  706. new iPlayersCount;
  707.  
  708. get_players( iPlayers, iPlayersNum );
  709. for( new i = 0 ; i < iPlayersNum ; i++ )
  710. {
  711. if( is_user_alive( iPlayers[ i ] ) )
  712. {
  713.  
  714. if( Team == 1 )
  715. {
  716. if( get_user_team( iPlayers[ i ] ) == 1 )
  717. {
  718. iPlayersCount++;
  719. }
  720. }
  721. else if( Team == 2 )
  722. {
  723. if( get_user_team( iPlayers[ i ] ) == 2 )
  724. {
  725. iPlayersCount++;
  726. }
  727. }
  728. }
  729.  
  730. }
  731.  
  732. return iPlayersCount;
  733.  
  734. }
  735.  
  736. stock GetRemainingPlayerId( const Team )
  737. {
  738. new iPlayers[ 32 ];
  739. new iPlayersNum;
  740.  
  741. new iPlayerId;
  742.  
  743. get_players( iPlayers, iPlayersNum );
  744. for( new i = 0 ; i < iPlayersNum ; i++ )
  745. {
  746. if( is_user_alive( iPlayers[ i ] ) )
  747. {
  748.  
  749. if( Team == 1 )
  750. {
  751.  
  752. if( get_user_team( iPlayers[ i ] ) == 1 )
  753. {
  754. iPlayerId = iPlayers[ i ];
  755. }
  756. }
  757. else if( Team == 2 )
  758. {
  759.  
  760. if( get_user_team( iPlayers[ i ] ) == 2 )
  761. {
  762. iPlayerId = iPlayers[ i ];
  763. }
  764. }
  765. }
  766.  
  767. }
  768.  
  769. return iPlayerId;
  770.  
  771. }
  772.  
  773. stock get_name( id )
  774. {
  775. new name[ 32 ];
  776. get_user_name( id, name, sizeof ( name ) -1 );
  777.  
  778. return name;
  779. }
  780. #if defined SPEARGUN
  781. public give_spear ( id ) {
  782.  
  783. set_user_speargun ( id, true );
  784.  
  785. }
  786.  
  787.  
  788. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  789. //---------------------------------------| SpearGun |--------------------------------------------------------
  790. //======================================= sDs|Aragon* =======================================================
  791. SpearGun_Init() {
  792. register_clcmd("furien30_speargun", "Hook_SpearGun");
  793.  
  794. register_event("CurWeapon", "SpearGun_ViewModel", "be", "1=1");
  795. register_event("WeapPickup","SpearGun_ViewModel","b","1=19");
  796.  
  797. register_forward(FM_SetModel, "SpearGun_WorldModel", 1);
  798. register_forward(FM_UpdateClientData, "SpearGun_UpdateClientData_Post", 1);
  799. register_forward(FM_PlaybackEvent, "SpearGun_PlaybackEvent");
  800. register_forward(FM_CmdStart, "SpearGun_CmdStart");
  801.  
  802. RegisterHam(Ham_Item_AddToPlayer, weapon_speargun, "SpearGun_AddToPlayer");
  803. RegisterHam(Ham_Item_Deploy , weapon_speargun, "SpearGun_Deploy_Post", 1);
  804. RegisterHam(Ham_Weapon_WeaponIdle, weapon_speargun, "SpearGun_WeaponIdle")
  805. RegisterHam(Ham_Weapon_PrimaryAttack, weapon_speargun, "SpearGun_PrimaryAttack");
  806. RegisterHam(Ham_Weapon_Reload, weapon_speargun, "SpearGun_Reload");
  807. RegisterHam(Ham_Weapon_Reload, weapon_speargun, "SpearGun_Reload_Post", 1);
  808. RegisterHam(Ham_Item_PostFrame, weapon_speargun, "SpearGun_PostFrame");
  809.  
  810. register_touch(SPEARGUN_CLASS, "*", "SpearGun_Touch");
  811.  
  812. speargundamage = register_cvar("furien30_speargun_damage", "200"); //| SpearGun Damage |//
  813. speargunreloadtime = register_cvar("furien30_speargun_reload_time", "1.0"); //| SpearGun Reload Time |//
  814. speargunradius = register_cvar("furien30_speargun_radius", "250.0"); //| SpearGun Bolt Radius |//
  815. speargunknockback = register_cvar("furien30_speargun_knockback", "3.0"); //| SpearGun Bolt Knockback |//
  816. }
  817.  
  818. SpearGun_Precache() {
  819. register_forward(FM_PrecacheEvent, "SpearGun_PrecacheEvent_Post", 1);
  820.  
  821. speargun_trail = precache_model("sprites/xbeam3.spr");
  822. speargun_explode = precache_model("sprites/furien30_weapons/explode.spr");
  823.  
  824. precache_model(SpearGunModel_V);
  825. precache_model(SpearGunModel_P);
  826. precache_model(SpearGunModel_W);
  827. precache_model(SpearGunModel_S);
  828. for(new i = 0; i < sizeof(SpearGun_Sound); i++)
  829. engfunc(EngFunc_PrecacheSound, SpearGun_Sound[i]);
  830. for(new i = 0; i < sizeof(SpearGun_Generic); i++)
  831. engfunc(EngFunc_PrecacheGeneric, SpearGun_Generic[i]);
  832. }
  833.  
  834. SpearGun_Natives() {
  835. register_native("get_user_speargun", "get_user_speargun", 1);
  836. register_native("set_user_speargun", "set_user_speargun", 1);
  837. }
  838.  
  839.  
  840. public SpearGun_ViewModel(id) {
  841. if(get_user_weapon(id) == CSW_SPEARGUN && get_user_speargun(id)) {
  842. set_pev(id, pev_viewmodel2, SpearGunModel_V);
  843. set_pev(id, pev_weaponmodel2, SpearGunModel_P);
  844. }
  845. return PLUGIN_CONTINUE
  846. }
  847.  
  848. public SpearGun_WorldModel(entity, model[]) {
  849. if(is_valid_ent(entity)) {
  850. static ClassName[33];
  851. entity_get_string(entity, EV_SZ_classname, ClassName, charsmax(ClassName));
  852.  
  853. if(equal(ClassName, "weaponbox")) {
  854. new Owner = entity_get_edict(entity, EV_ENT_owner);
  855. new _SpearGun = find_ent_by_owner(-1, weapon_speargun, entity);
  856.  
  857. if(get_user_speargun(Owner) && is_valid_ent(_SpearGun) && equal(model, "models/w_galil.mdl")) {
  858. entity_set_int(_SpearGun, EV_INT_impulse, SPEARGUN_WEAPONKEY);
  859. HaveSpearGun[Owner] = false;
  860. entity_set_model(entity, SpearGunModel_W);
  861. }
  862. }
  863. }
  864. return FMRES_IGNORED;
  865. }
  866.  
  867. public SpearGun_UpdateClientData_Post(id, sendweapons, cd_handle) {
  868. if(is_user_alive(id) && is_user_connected(id) && get_user_weapon(id) == CSW_SPEARGUN && get_user_speargun(id))
  869. set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001);
  870. return FMRES_IGNORED;
  871. }
  872.  
  873. public SpearGun_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2) {
  874. if(is_user_connected(invoker) && eventid == speargun_event)
  875. playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2);
  876. return FMRES_IGNORED;
  877. }
  878.  
  879. public SpearGun_PrecacheEvent_Post(type, const name[]) {
  880. if (equal("events/galil.sc", name))
  881. speargun_event = get_orig_retval();
  882. return FMRES_IGNORED;
  883. }
  884.  
  885. public SpearGun_CmdStart(id, uc_handle, seed) {
  886. if(is_user_alive(id) && is_user_connected(id)) {
  887. static CurButton;
  888. CurButton = get_uc(uc_handle, UC_Buttons);
  889. new Float:NextAttack = get_pdata_float(id, 83, 5);
  890.  
  891.  
  892. if(CurButton & IN_ATTACK) {
  893. if(get_user_weapon(id) == CSW_SPEARGUN && get_user_speargun(id)) {
  894. static _SpearGun;
  895. _SpearGun = fm_find_ent_by_owner(-1, weapon_speargun, id);
  896.  
  897. if(pev_valid(_SpearGun) && cs_get_weapon_ammo(_SpearGun) > 0 && !speargun_reload[id] && NextAttack <= 0.0) {
  898. set_weapon_anim(id, 1);
  899. emit_sound(id, CHAN_WEAPON, SpearGun_Sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM);
  900. SpearGun_Fire(id);
  901. new Float:PunchAngle[3]
  902. PunchAngle[0] = random_float(-5.0, -7.0), PunchAngle[1] = 0.0, PunchAngle[0] = 0.0
  903. set_pev(id, pev_punchangle, PunchAngle);
  904. cs_set_weapon_ammo(_SpearGun, cs_get_weapon_ammo(_SpearGun) - 1);
  905. if(cs_get_weapon_ammo(_SpearGun) > 0 && !speargun_reload[id] && NextAttack <= 0.0) {
  906. set_pdata_float(id, 83, speargun_shotdelay, 5);
  907. set_pdata_float(_SpearGun, 48, 1.0, 4)
  908. }
  909. }
  910. CurButton &= ~IN_ATTACK;
  911. set_uc(uc_handle, UC_Buttons, CurButton);
  912. }
  913. }
  914. }
  915. return FMRES_IGNORED;
  916. }
  917.  
  918. public SpearGun_AddToPlayer(Weapon, id) {
  919. if(pev_valid(Weapon) && is_user_alive(id) && entity_get_int(Weapon, EV_INT_impulse) == SPEARGUN_WEAPONKEY) {
  920. HaveSpearGun[id] = true;
  921. WeaponList(id, SPEARGUN_WEAPONKEY)
  922. entity_set_int(Weapon, EV_INT_impulse, 0);
  923. }
  924. return HAM_IGNORED;
  925. }
  926.  
  927. public SpearGun_Deploy_Post(Weapon) {
  928. if(pev_valid(Weapon)) {
  929. new Owner = get_pdata_cbase(Weapon, 41, 4);
  930.  
  931. if(is_user_alive(Owner) && get_user_speargun(Owner)) {
  932. set_pev(Owner, pev_viewmodel2, SpearGunModel_V);
  933. set_pev(Owner, pev_weaponmodel2, SpearGunModel_P);
  934. set_weapon_anim(Owner, 3)
  935.  
  936. set_pdata_float(Owner, 83, 1.2, 5);
  937. set_pdata_float(Weapon, 48, 1.2, 4)
  938.  
  939. if(cs_get_weapon_ammo(Weapon) > 0)
  940. speargun_reload[Owner] = 0;
  941. }
  942. }
  943. return HAM_IGNORED;
  944. }
  945.  
  946. public SpearGun_WeaponIdle(Weapon) {
  947. if(pev_valid(Weapon)) {
  948. new Owner = get_pdata_cbase(Weapon, 41, 4);
  949.  
  950. if(is_user_alive(Owner) && get_user_speargun(Owner) && get_pdata_float(Weapon, 48, 4) <= 0.1) {
  951. set_pdata_float(Weapon, 48, 1.7, 4)
  952. set_weapon_anim(Owner, 0)
  953. }
  954. }
  955. return HAM_IGNORED;
  956. }
  957.  
  958. public SpearGun_PrimaryAttack(Weapon) {
  959. if(pev_valid(Weapon)) {
  960. new Owner = get_pdata_cbase(Weapon, 41, 4);
  961. if(is_user_alive(Owner) && get_user_speargun(Owner))
  962. return HAM_SUPERCEDE;
  963. }
  964. return HAM_IGNORED;
  965. }
  966.  
  967. public SpearGun_Reload(Weapon) {
  968. if(pev_valid(Weapon)) {
  969. new Owner = get_pdata_cbase(Weapon, 41, 4);
  970.  
  971. if(is_user_alive(Owner) && get_user_speargun(Owner)) {
  972. speargun_clip[Owner] = -1;
  973.  
  974. if(cs_get_user_bpammo(Owner, CSW_SPEARGUN) <= 0 || get_pdata_int(Weapon, 51, 4) >= 1)
  975. return HAM_SUPERCEDE;
  976.  
  977. speargun_clip[Owner] = get_pdata_int(Weapon, 51, 4);
  978. speargun_reload[Owner] = true;
  979. }
  980. }
  981. return HAM_IGNORED;
  982. }
  983.  
  984. public SpearGun_Reload_Post(Weapon) {
  985. if(pev_valid(Weapon)) {
  986. new Owner = get_pdata_cbase(Weapon, 41, 4);
  987.  
  988. if(is_user_alive(Owner) && get_user_speargun(Owner) && speargun_clip[Owner] != -1) {
  989. set_pdata_int(Weapon, 51, speargun_clip[Owner], 4);
  990. set_pdata_float(Weapon, 48, get_pcvar_float(speargunreloadtime), 4);
  991. set_pdata_float(Owner, 83, get_pcvar_float(speargunreloadtime), 5);
  992. set_pdata_int(Weapon, 54, 1, 4);
  993. set_weapon_anim(Owner, 2)
  994. }
  995. }
  996. return HAM_IGNORED;
  997. }
  998.  
  999. public SpearGun_PostFrame(Weapon) {
  1000. if(pev_valid(Weapon)) {
  1001. new Owner = get_pdata_cbase(Weapon, 41, 4);
  1002.  
  1003. if(is_user_alive(Owner) && get_user_speargun(Owner) && get_pdata_int(Weapon, 54, 4) && get_pdata_float(Owner, 83, 5) <= 0.0) {
  1004. new Temp = min(1 - get_pdata_int(Weapon, 51, 4), cs_get_user_bpammo(Owner, CSW_SPEARGUN));
  1005.  
  1006. set_pdata_int(Weapon, 51, get_pdata_int(Weapon, 51, 4) + Temp, 4);
  1007. cs_set_user_bpammo(Owner, CSW_SPEARGUN, cs_get_user_bpammo(Owner, CSW_SPEARGUN) - Temp);
  1008. set_pdata_int(Weapon, 54, 0, 4);
  1009.  
  1010. speargun_reload[Owner] = false;
  1011. }
  1012. }
  1013. return HAM_IGNORED;
  1014. }
  1015.  
  1016. public SpearGun_Fire(id) {
  1017. new Bolt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
  1018.  
  1019. if(pev_valid(Bolt)) {
  1020. new Float:Origin[3], Float:Angles[3], Float:Velocity[3];
  1021. engfunc(EngFunc_GetAttachment, id, 0, Origin, Angles);
  1022. pev(id, pev_angles, Angles);
  1023.  
  1024. set_pev(Bolt, pev_origin, Origin);
  1025. set_pev(Bolt, pev_angles, Angles);
  1026. set_pev(Bolt, pev_solid, SOLID_BBOX);
  1027. set_pev(Bolt, pev_movetype, MOVETYPE_FLY);
  1028.  
  1029. set_pev(Bolt, pev_classname, SPEARGUN_CLASS);
  1030.  
  1031. set_pev(Bolt, pev_owner, id);
  1032. engfunc(EngFunc_SetModel, Bolt, SpearGunModel_S);
  1033.  
  1034. set_pev(Bolt, pev_mins, {-1.0, -1.0, -1.0});
  1035. set_pev(Bolt, pev_maxs, {1.0, 1.0, 1.0});
  1036.  
  1037. velocity_by_aim(id, 2000, Velocity);
  1038. set_pev(Bolt, pev_velocity, Velocity);
  1039.  
  1040. message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
  1041. write_byte(TE_BEAMFOLLOW); // TE id
  1042. write_short(Bolt); // entity:attachment to follow
  1043. write_short(speargun_trail); // sprite index
  1044. write_byte(1); // life in 0.1's
  1045. write_byte(1); // line width in 0.1's
  1046. write_byte(255); // r
  1047. write_byte(255); // g
  1048. write_byte(255); // b
  1049. write_byte(200); // brightness
  1050. message_end();
  1051. }
  1052. }
  1053.  
  1054. public SpearGun_Touch(Bolt, touch) {
  1055. if(is_valid_ent(Bolt)) {
  1056. static Float:BoltOrigin[3];
  1057. pev(Bolt, pev_origin, BoltOrigin);
  1058. new id = pev(Bolt, pev_owner);
  1059.  
  1060. message_begin(MSG_BROADCAST ,SVC_TEMPENTITY);
  1061. write_byte(TE_EXPLOSION);
  1062. engfunc(EngFunc_WriteCoord, BoltOrigin[0]);
  1063. engfunc(EngFunc_WriteCoord, BoltOrigin[1]);
  1064. engfunc(EngFunc_WriteCoord, BoltOrigin[2]);
  1065. write_short(speargun_explode); // sprite index
  1066. write_byte(20); // scale in 0.1's
  1067. write_byte(30); // framerate
  1068. write_byte(0); // flags
  1069. message_end();
  1070.  
  1071. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  1072. write_byte(TE_WORLDDECAL)
  1073. engfunc(EngFunc_WriteCoord, BoltOrigin[0])
  1074. engfunc(EngFunc_WriteCoord, BoltOrigin[1])
  1075. engfunc(EngFunc_WriteCoord, BoltOrigin[2])
  1076. write_byte(random_num(46, 48))
  1077. message_end()
  1078.  
  1079. static ClassName[32];
  1080. pev(touch, pev_classname, ClassName, charsmax(ClassName));
  1081. if(equal(ClassName, "player") && is_user_connected(touch) && is_user_alive(touch)) {
  1082. if(!fm_get_user_godmode(touch) && get_user_team(touch) != get_user_team(id) && touch != id) {
  1083. new Float:Damage = get_pcvar_float(speargundamage);
  1084. //make_blood(touch, get_pcvar_num(speargundamage))
  1085. make_knockback(touch, BoltOrigin, get_pcvar_float(speargunknockback) * Damage);
  1086. if(get_user_health(touch) > Damage)
  1087. ExecuteHam(Ham_TakeDamage, touch, id, id, Damage, DMG_BLAST);
  1088. else
  1089. death_message(id, touch, "SpearGun");
  1090.  
  1091. }
  1092. }
  1093. else if(equal(ClassName, "func_breakable")) {
  1094. if(entity_get_float(touch, EV_FL_health) <= get_pcvar_num(speargundamage))
  1095. force_use(id, touch);
  1096. }
  1097.  
  1098. for(new Victim = 1; Victim < get_maxplayers(); Victim++) {
  1099. if(is_user_connected(Victim) && is_user_alive(Victim) && !fm_get_user_godmode(Victim) && get_user_team(Victim) != get_user_team(id) && Victim != id && Victim != touch) {
  1100. new Float:VictimOrigin[3], Float:Distance_F, Distance;
  1101. pev(Victim, pev_origin, VictimOrigin);
  1102. Distance_F = get_distance_f(BoltOrigin, VictimOrigin);
  1103. Distance = floatround(Distance_F);
  1104. if(Distance <= get_pcvar_float(speargunradius)) {
  1105. new Float:DistanceRatio, Float:Damage;
  1106. DistanceRatio = floatdiv(float(Distance), get_pcvar_float(speargunradius));
  1107. Damage = get_pcvar_float(speargundamage) - floatround(floatmul(get_pcvar_float(speargundamage), DistanceRatio));
  1108. //make_blood(Victim, floatround(Damage))
  1109. make_knockback(Victim, BoltOrigin, get_pcvar_float(speargunknockback)*Damage);
  1110. if(get_user_health(Victim) - Damage >= 1)
  1111. ExecuteHam(Ham_TakeDamage, Victim, id, id, Damage, DMG_BLAST);
  1112. else
  1113. death_message(id, Victim, "SpearGun");
  1114. }
  1115. }
  1116. }
  1117. engfunc(EngFunc_RemoveEntity, Bolt);
  1118. }
  1119. }
  1120.  
  1121. public Hook_SpearGun(id) {
  1122. engclient_cmd(id, weapon_speargun);
  1123. return PLUGIN_HANDLED
  1124. }
  1125.  
  1126. public get_user_speargun(id)
  1127. return HaveSpearGun[id];
  1128.  
  1129. public set_user_speargun(id, speargun) {
  1130. if(speargun) {
  1131. if(!HaveSpearGun[id]) {
  1132. drop_primary_weapons(id);
  1133. HaveSpearGun[id] = true;
  1134. speargun_reload[id] = 0;
  1135.  
  1136. WeaponList(id, SPEARGUN_WEAPONKEY)
  1137. fm_give_item(id, weapon_speargun);
  1138.  
  1139. new Clip = fm_get_user_weapon_entity(id, CSW_SPEARGUN);
  1140. cs_set_weapon_ammo(Clip, 1);
  1141. }
  1142. }
  1143. else {
  1144. if(HaveSpearGun[id])
  1145. HaveSpearGun[id] = false;
  1146. }
  1147. }
  1148.  
  1149. public WeaponList(id, WEAPONKEY) {
  1150. new Message_WeaponList = get_user_msgid("WeaponList")
  1151.  
  1152. switch(WEAPONKEY) {
  1153.  
  1154. case SPEARGUN_WEAPONKEY: {
  1155. message_begin(MSG_ONE, Message_WeaponList, _, id);
  1156. write_string(HaveSpearGun[id] ? "furien30_speargun" : "weapon_galil"); // WeaponName
  1157. write_byte(4); // PrimaryAmmoID
  1158. write_byte(90); // PrimaryAmmoMaxAmount
  1159. write_byte(-1); // SecondaryAmmoID
  1160. write_byte(-1); // SecondaryAmmoMaxAmount
  1161. write_byte(0); // SlotID (0...N)
  1162. write_byte(17); // NumberInSlot (1...N)
  1163. write_byte(CSW_SPEARGUN); // WeaponID
  1164. write_byte(0); // Flags
  1165. message_end();
  1166. }
  1167.  
  1168. }
  1169.  
  1170.  
  1171. }
  1172.  
  1173. stock set_weapon_anim(id, anim) {
  1174. set_pev(id, pev_weaponanim, anim);
  1175. if(is_user_connected(id)) {
  1176. message_begin(MSG_ONE, SVC_WEAPONANIM, _, id);
  1177. write_byte(anim);
  1178. write_byte(pev(id, pev_body));
  1179. message_end();
  1180. }
  1181. }
  1182.  
  1183. stock drop_primary_weapons(Player) {
  1184. static weapons[32], num, i, weaponid;
  1185. num = 0;
  1186. get_user_weapons(Player, weapons, num);
  1187.  
  1188. for(i = 0; i < num; i++) {
  1189. weaponid = weapons [i];
  1190.  
  1191. if(((1<<weaponid) & PRIMARY_WEAPONS_BITSUM)) {
  1192. static wname[32];
  1193. get_weaponname(weaponid, wname, charsmax(wname));
  1194.  
  1195. engclient_cmd(Player, "drop", wname);
  1196. }
  1197. }
  1198. }
  1199.  
  1200. #endif
  1201. stock death_message(Killer, Victim, const Weapon[]) {
  1202. set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET);
  1203. ExecuteHamB(Ham_Killed, Victim, Killer, 2);
  1204. set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT);
  1205.  
  1206. make_deathmsg(Killer, Victim, 0, Weapon);
  1207. cs_set_user_money(Killer, cs_get_user_money(Killer) + 300);
  1208.  
  1209. message_begin(MSG_BROADCAST, get_user_msgid("ScoreInfo"));
  1210. write_byte(Killer); // id
  1211. write_short(pev(Killer, pev_frags)); // frags
  1212. write_short(cs_get_user_deaths(Killer)); // deaths
  1213. write_short(0); // class?
  1214. write_short(get_user_team(Killer)); // team
  1215. message_end();
  1216.  
  1217. message_begin(MSG_BROADCAST, get_user_msgid("ScoreInfo"));
  1218. write_byte(Victim); // id
  1219. write_short(pev(Victim, pev_frags)); // frags
  1220. write_short(cs_get_user_deaths(Victim)); // deaths
  1221. write_short(0); // class?
  1222. write_short(get_user_team(Victim)); // team
  1223. message_end();
  1224. }
  1225.  
  1226. public make_knockback(Victim, Float:origin[3], Float:maxspeed) {
  1227. new Float:fVelocity[3];
  1228. kickback(Victim, origin, maxspeed, fVelocity);
  1229. entity_set_vector(Victim, EV_VEC_velocity, fVelocity);
  1230.  
  1231. return(1);
  1232. }
  1233.  
  1234. stock kickback(ent, Float:fOrigin[3], Float:fSpeed, Float:fVelocity[3]) {
  1235. new Float:fEntOrigin[3];
  1236. entity_get_vector(ent, EV_VEC_origin, fEntOrigin);
  1237.  
  1238. new Float:fDistance[3];
  1239. fDistance[0] = fEntOrigin[0] - fOrigin[0];
  1240. fDistance[1] = fEntOrigin[1] - fOrigin[1];
  1241. fDistance[2] = fEntOrigin[2] - fOrigin[2];
  1242. new Float:fTime = (vector_distance(fEntOrigin,fOrigin) / fSpeed);
  1243. fVelocity[0] = fDistance[0] / fTime;
  1244. fVelocity[1] = fDistance[1] / fTime;
  1245. fVelocity[2] = fDistance[2] / fTime;
  1246.  
  1247. return(fVelocity[0] && fVelocity[1] && fVelocity[2]);
  1248. }
  1249.  
  1250.  
  1251. stock Create_ScreenFade(id, duration, holdtime, fadetype, red, green, blue, alpha){
  1252. if(is_user_connected(id)) {
  1253. message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id)
  1254. write_short(duration) // fade lasts this long duration
  1255. write_short(holdtime) // fade lasts this long hold time
  1256. write_short(fadetype) // fade type(in / out)
  1257. write_byte(red) // fade red
  1258. write_byte(green) // fade green
  1259. write_byte(blue) // fade blue
  1260. write_byte(alpha) // fade alpha
  1261. message_end()
  1262. }
  1263. }
  1264.  
  1265. stock Create_ScreenShake(id, amount, duration, frequency){
  1266. if(is_user_connected(id)) {
  1267. message_begin(MSG_ONE,get_user_msgid("ScreenShake"),{0,0,0},id)
  1268. write_short(amount) // ammount
  1269. write_short(duration) // lasts this long
  1270. write_short(frequency) // frequency
  1271. message_end()
  1272. }
  1273. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement