HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include < amxmodx >
  2. #include < fakemeta >
  3. #include < xs >
  4. #include < hamsandwich >
  5. #include < zombieplague >
  6.  
  7. new const PLUGIN_VERSION[ ] = "0.1";
  8. new const PLUGIN_NAME[ ] = "[ ZP ] Nemesis skill";
  9.  
  10. new const BALL__MODEL[ ] = "sprites/lord.spr";
  11. new const BALL_SHOOTSOUND[ ] = "deimos_skill_start.wav";
  12. new const EXPLODE__SPRITE[ ] = "sprites/ex.spr";
  13. new const BALL__CLASSNAME[ ] = "szClassBall";
  14.  
  15. const Float:SPEED__BALL = 800.0; //Labda gyorsasaga
  16. const Float:DAMAGE__BALL = 500.0; // Sebzes erteke
  17. const Float:RELOAD__SKILL = 10.0; //Mennyi ido utan lehessen ujra
  18. const Float:RADIUS__SKILL = 200.0; //Sebzes hatosugara
  19.  
  20. const MAX_CLIENTS = 32;
  21.  
  22. new g_iSkill[ MAX_CLIENTS + 1 ];
  23.  
  24. new g_Ball = 1
  25.  
  26. new g_iExp;
  27.  
  28. enum _:Coord_e
  29. {
  30. Float:x,
  31. Float:y,
  32. Float:z
  33. };
  34.  
  35. enum _:Angle_e
  36. {
  37. Float:pitch,
  38. Float:yaw,
  39. Float:roll
  40. };
  41.  
  42. #define VectorScale(%1,%2,%3) ( %3[ x ] = %2 * %1[ x ], %3[ y ] = %2 * %1[ y ], %3[ z ] = %2 * %1[ z ] )
  43.  
  44. public plugin_init( )
  45. {
  46. register_plugin(PLUGIN_NAME,PLUGIN_VERSION,"Shurik07");
  47.  
  48. register_clcmd( "drop" , "ClCommand__UseSkill" );
  49.  
  50. register_forward( FM_Touch , "Forward_Touch" );
  51. }
  52.  
  53. public plugin_precache( )
  54. {
  55. engfunc( EngFunc_PrecacheModel , BALL__MODEL );
  56. engfunc( EngFunc_PrecacheSound , BALL_SHOOTSOUND );
  57.  
  58. g_iExp = engfunc( EngFunc_PrecacheModel , EXPLODE__SPRITE );
  59. }
  60.  
  61. public zp_user_infected_post( pID , pInfector , pNemesis )
  62. {
  63. if( !is_user_alive( pID ) )
  64. {
  65. return
  66. }
  67.  
  68. if( zp_get_user_nemesis( pID ) )
  69. {
  70. g_iSkill[ pID ] = true ;
  71.  
  72. client_print( pID , print_center , "Használd a labda képességed , 'G'-betűvel!" );
  73. }
  74. }
  75.  
  76. public ClCommand__UseSkill( pID )
  77. {
  78. if( !is_user_alive( pID ) )
  79. {
  80. return PLUGIN_CONTINUE;
  81. }
  82.  
  83. if( zp_get_user_nemesis( pID ) && g_iSkill[ pID ] )
  84. {
  85. static Float:vf_Forward[ Coord_e ], Float:vf_vAngle[ Angle_e ];
  86. static Float:vf_Source [ Coord_e ];
  87.  
  88. UTIL_GetPosition( pID , vf_Source, 40.0, 4.0, -5.0 )
  89.  
  90. global_get ( glb_v_forward, vf_Forward );
  91. pev ( pID, pev_v_angle, vf_vAngle );
  92.  
  93. static Float:vf_VelocitySR[ Coord_e ]
  94.  
  95. VectorScale ( vf_Forward, SPEED__BALL , vf_VelocitySR );
  96.  
  97. UTIL__SetBall( vf_Source , vf_VelocitySR , pID );
  98.  
  99. engfunc( EngFunc_EmitSound, pID, CHAN_ITEM, BALL_SHOOTSOUND, 1.0, ATTN_NORM, 0, PITCH_NORM);
  100.  
  101. g_iSkill[ pID ] = false;
  102.  
  103. client_print( pID , print_center , "Várj %s másodpercet ,hogy ujra használd a képességed!" , RELOAD__SKILL );
  104.  
  105. set_task( RELOAD__SKILL , "Return__Skill" , pID );
  106. }
  107.  
  108. return PLUGIN_CONTINUE;
  109. }
  110.  
  111. public UTIL__SetBall ( const Float:vf_Origin[], const Float:vf_Velocity[], const i_Owner )
  112. {
  113. static pEntity;
  114.  
  115. if ( ( pEntity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_sprite") ) ) )
  116. {
  117. static vf_Temp[ Angle_e ]
  118.  
  119. set_pev ( pEntity , pev_classname , BALL__CLASSNAME );
  120. set_pev ( pEntity, pev_origin, vf_Origin );
  121. set_pev ( pEntity, pev_owner, i_Owner );
  122.  
  123. set_pev ( pEntity, pev_movetype, MOVETYPE_FLY );
  124. set_pev ( pEntity, pev_solid, SOLID_TRIGGER );
  125. set_pev ( pEntity, pev_gravity, -1.0 );
  126.  
  127. engfunc ( EngFunc_VecToAngles, vf_Velocity, vf_Temp );
  128. set_pev ( pEntity, pev_angles, vf_Temp );
  129.  
  130. engfunc ( EngFunc_SetModel , pEntity, BALL__MODEL );
  131. engfunc ( EngFunc_SetSize , pEntity, Float:{ 0.0, 0.0, 0.0 }, Float:{ 0.0, 0.0, 0.0 } );
  132. engfunc ( EngFunc_SetOrigin, pEntity, vf_Origin );
  133.  
  134. set_pev ( pEntity, pev_velocity, vf_Velocity );
  135. set_pev ( pEntity, pev_rendermode, kRenderTransAdd )
  136. set_pev ( pEntity, pev_renderamt, 255.0 )
  137.  
  138. set_pev ( pEntity , pev_iuser1 , g_Ball );
  139. }
  140. }
  141.  
  142.  
  143. public Forward_Touch( const pEntity , pOther )
  144. {
  145. if( !pev_valid( pEntity ) )
  146. {
  147. return FMRES_IGNORED ;
  148. }
  149.  
  150. static zsClassname[ 32 ];
  151.  
  152. pev( pEntity, pev_classname, zsClassname, charsmax( zsClassname ) );
  153.  
  154. if( !equal( zsClassname, BALL__CLASSNAME ) )
  155. {
  156. return FMRES_IGNORED;
  157. }
  158.  
  159. if( pev( pEntity , pev_iuser1 ) )
  160. {
  161. UTIL_SetTouch ( pEntity , pOther )
  162. }
  163.  
  164. return FMRES_IGNORED
  165. }
  166.  
  167. public UTIL_SetTouch( pEntity ,pOther )
  168. {
  169. if( !pev_valid( pEntity ) )
  170. {
  171. return;
  172. }
  173.  
  174. static Float:flOrigin[ Coord_e ];
  175. pev( pEntity, pev_origin, flOrigin );
  176.  
  177. set_pev(pEntity, pev_movetype, MOVETYPE_NONE)
  178. set_pev(pEntity, pev_solid, SOLID_NOT)
  179.  
  180. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  181. write_byte(TE_EXPLOSION)
  182. engfunc(EngFunc_WriteCoord , flOrigin[x] )
  183. engfunc(EngFunc_WriteCoord , flOrigin[y] )
  184. engfunc(EngFunc_WriteCoord , flOrigin[z] )
  185. write_short( g_iExp )
  186. write_byte( 50 )
  187. write_byte( 24 )
  188. write_byte( 0 )
  189. message_end( )
  190.  
  191. new pOwner = pev( pEntity, pev_owner );
  192.  
  193. static pevVictim, Float:flDistance,Float:fDamage;
  194.  
  195. pevVictim = -1;
  196.  
  197. while( ( pevVictim = engfunc( EngFunc_FindEntityInSphere, pevVictim, flOrigin, RADIUS__SKILL) ) != 0 )
  198. {
  199.  
  200. if( !is_user_alive( pevVictim ) )
  201. continue;
  202.  
  203. if( zp_get_user_zombie( pevVictim ) )
  204. continue;
  205.  
  206. flDistance = fm_entity_range( pEntity, pevVictim );
  207.  
  208. fDamage = UTIL_FloatRadius( DAMAGE__BALL, RADIUS__SKILL , flDistance );
  209.  
  210. if( fDamage > 0.0 )
  211. {
  212. ExecuteHamB( Ham_TakeDamage, pevVictim, pEntity, pOwner, fDamage, DMG_BULLET | DMG_ALWAYSGIB );
  213.  
  214. }
  215. }
  216.  
  217. engfunc( EngFunc_RemoveEntity, pEntity );
  218. }
  219.  
  220. public Return__Skill( pID )
  221. {
  222. if( is_user_alive( pID ) )
  223. {
  224. g_iSkill[ pID ] = true
  225.  
  226. client_print( pID , print_center , "A képességed ész , használatához nyomd 'G'-betűt!" );
  227. }
  228. }
  229.  
  230. Float:UTIL_FloatRadius( Float:flMaxAmount, Float:flRadius, Float:flDistance )
  231. {
  232. return floatsub( flMaxAmount, floatmul( floatdiv( flMaxAmount, flRadius ), flDistance ) );
  233. }
  234.  
  235. stock UTIL_GetPosition(id, Float:fOrigin[ ], Float:add_forward=0.0, Float:add_right=0.0, Float:add_up=0.0)
  236. {
  237. static Float:Angles[ Angle_e ],Float:ViewOfs[ Coord_e ], Float:vAngles[ Angle_e ]
  238. static Float:Forward[ Coord_e ], Float:Right[ Coord_e ], Float:Up[ Coord_e ]
  239.  
  240. pev(id, pev_v_angle, vAngles)
  241. pev(id, pev_origin, fOrigin)
  242. pev(id, pev_view_ofs, ViewOfs)
  243. xs_vec_add(fOrigin, ViewOfs, fOrigin)
  244.  
  245. pev(id, pev_angles, Angles)
  246.  
  247. Angles[0]= vAngles[0]
  248.  
  249. engfunc(EngFunc_MakeVectors, Angles)
  250.  
  251. global_get(glb_v_forward, Forward)
  252. global_get(glb_v_right, Right)
  253. global_get(glb_v_up, Up)
  254.  
  255. xs_vec_mul_scalar(Forward, add_forward, Forward)
  256. xs_vec_mul_scalar(Right, add_right, Right)
  257. xs_vec_mul_scalar(Up, add_up, Up)
  258.  
  259. fOrigin[0]=fOrigin[0]+Forward[0]+Right[0]+Up[0]
  260. fOrigin[1]=fOrigin[1]+Forward[1]+Right[1]+Up[1]
  261. fOrigin[2]=fOrigin[2]+Forward[2]+Right[2]+Up[2]
  262. }
  263.  
  264. stock Float:fm_entity_range(ent1, ent2)
  265. {
  266. new Float:origin1[3], Float:origin2[3]
  267. pev(ent1, pev_origin, origin1)
  268. pev(ent2, pev_origin, origin2)
  269.  
  270. return get_distance_f(origin1, origin2)
  271. }
  272. stock print_color(const id, const input[], any:...)
  273. {
  274. new count = 1, players[32]
  275. static msg[191]
  276. vformat(msg, 190, input, 3)
  277.  
  278. replace_all(msg, 190, "!g", "^4")
  279. replace_all(msg, 190, "!y", "^1")
  280. replace_all(msg, 190, "!t", "^3")
  281. replace_all(msg, 190, "", "á")
  282. replace_all(msg, 190, "", "é")
  283. replace_all(msg, 190, "", "í")
  284. replace_all(msg, 190, "", "ó")
  285. replace_all(msg, 190, "", "ö")
  286. replace_all(msg, 190, "", "ő")
  287. replace_all(msg, 190, "", "ú")
  288. replace_all(msg, 190, "", "ü")
  289. replace_all(msg, 190, "", "ű")
  290. replace_all(msg, 190, "", "Á")
  291. replace_all(msg, 190, "", "É")
  292. replace_all(msg, 190, "", "Í")
  293. replace_all(msg, 190, "", "Ó")
  294. replace_all(msg, 190, "", "Ö")
  295. replace_all(msg, 190, "", "Ő")
  296. replace_all(msg, 190, "", "Ú")
  297. replace_all(msg, 190, "", "Ü")
  298. replace_all(msg, 190, "", "Ű")
  299.  
  300. if (id) players[0] = id; else get_players(players, count, "ch")
  301. {
  302. for (new i = 0; i < count; i++)
  303. {
  304. if (is_user_connected(players[i]))
  305. {
  306. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  307. write_byte(players[i])
  308. write_string(msg)
  309. message_end()
  310. }
  311. }
  312. }
  313. return PLUGIN_HANDLED
  314. }
  315.