Advertisement
Guest User

xmasr_frostnade.sma

a guest
Mar 19th, 2024
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.79 KB | None | 0 0
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include < amxmodx >
  4. #include < cstrike >
  5. #include < fakemeta >
  6. #include < engine >
  7. #include < hamsandwich >
  8.  
  9. #define TASK_EXPLODE(%1) ( 799 + %1 )
  10. #define UNTASK_EXPLODE(%1) ( %1 - 799)
  11.  
  12. #define TASK_UNFREEZE(%1) ( 899 + %1 )
  13. #define UNTASK_UNFREEZE(%1) ( %1 - 899 )
  14.  
  15. #define ice_model "models/xmasreborn/xmasice.mdl"
  16.  
  17. new bool: g_bFreezed[ 33 ], g_iBeaconSprite, g_iExplodeSprite;
  18. new iceent[ 33 ];
  19.  
  20. enum _:FrostSounds
  21. {
  22. Explode,
  23. Hit,
  24. Unfreeze
  25. }
  26.  
  27. new const szFrostSoundsPath[ FrostSounds ][ ] = {
  28. "warcraft3/frostnova.wav",
  29. "warcraft3/impalehit.wav",
  30. "warcraft3/impalelaunch1.wav"
  31. }
  32.  
  33. new const plugin_info[ 3 ][ ] = {
  34. "Frostnades [REBORN]",
  35. "1.0.0b",
  36. "+ColdWar & csfweed01's edit"
  37. }
  38.  
  39. public plugin_precache( )
  40. {
  41. for( new i = 0 ; i < FrostSounds ; i ++ )
  42. precache_sound( szFrostSoundsPath[ i ] );
  43.  
  44. g_iBeaconSprite = precache_model( "sprites/shockwave.spr" );
  45. g_iExplodeSprite = precache_model( "sprites/xmasreborn/frost_explode.spr" );
  46.  
  47. engfunc(EngFunc_PrecacheModel, ice_model);
  48.  
  49. }
  50.  
  51. public plugin_init()
  52. {
  53. register_plugin( plugin_info[ 0 ] , plugin_info[ 1 ] , plugin_info[ 2 ] );
  54. register_forward( FM_SetModel, "Fwd_SetModel_Pre" );
  55. RegisterHam( Ham_Killed, "player", "fnPlayerDead" );
  56. register_event( "HLTV", "Event_NewRound", "a", "1=0", "2=0" );
  57. }
  58.  
  59. public Fwd_SetModel_Pre( iEnt, const Model[] )
  60. {
  61. new iOwner = pev( iEnt, pev_owner );
  62. if( !pev_valid( iEnt ) || !equal( Model, "models/w_smokegrenade.mdl" ) || !is_user_connected( iOwner ) )
  63. return;
  64. set_pev( iEnt, pev_nextthink, get_gametime( ) + 5.0 );
  65. set_task( 1.5, "fnExplodeNade", TASK_EXPLODE( iEnt ) );
  66. }
  67.  
  68. public fnExplodeNade( Task_ID )
  69. {
  70. new iEnt = UNTASK_EXPLODE( Task_ID );
  71. if( !pev_valid( iEnt ) )
  72. return;
  73. new iOwner = pev( iEnt, pev_owner ), Float: g_flOrigin[ 3 ], g_iOrigin[ 3 ], Float: g_flPlayerOrigin[ 3 ];
  74.  
  75. pev( iEnt, pev_origin, g_flOrigin );
  76.  
  77. g_iOrigin[ 0 ] = floatround( g_flOrigin[ 0 ] );
  78. g_iOrigin[ 1 ] = floatround( g_flOrigin[ 1 ] );
  79. g_iOrigin[ 2 ] = floatround( g_flOrigin[ 2 ] );
  80.  
  81. CmdExplodeBeacon( g_iOrigin )
  82.  
  83. engfunc( EngFunc_EmitSound, iEnt, CHAN_WEAPON, szFrostSoundsPath[ Explode ], 1.0, ATTN_NORM, 0, PITCH_NORM );
  84.  
  85. for( new i = 1 ; i < get_maxplayers( ) ; i ++ )
  86. {
  87. if( !is_user_connected( i ) || !is_user_alive( i ) || i == iOwner || g_bFreezed[ i ])
  88. continue;
  89.  
  90. pev( i, pev_origin, g_flPlayerOrigin );
  91.  
  92. if( get_distance_f( g_flPlayerOrigin, g_flOrigin ) > 240.0 )
  93. continue;
  94.  
  95. if(!is_user_alive(i))
  96. continue
  97. if(cs_get_user_team(i) == cs_get_user_team(iOwner))
  98. continue
  99.  
  100. ice_entity( i, 1 )
  101.  
  102. g_bFreezed[ i ] = true;
  103.  
  104. set_task( 2.5, "Fwd_Unfreeze", TASK_UNFREEZE( i ) );
  105.  
  106.  
  107. engfunc( EngFunc_EmitSound, i, CHAN_WEAPON, szFrostSoundsPath[ Hit ], 1.0, ATTN_NORM, 0, PITCH_NORM)
  108.  
  109. message_begin( MSG_ONE, get_user_msgid("ScreenFade"), _, i);
  110. write_short( ~0 );
  111. write_short( ~0 );
  112. write_short( 0x0004 );
  113. write_byte( 100 );
  114. write_byte( 200 );
  115. write_byte( 255 );
  116. write_byte( 100 );
  117. message_end( );
  118. }
  119.  
  120. engfunc( EngFunc_RemoveEntity , iEnt )
  121. }
  122.  
  123. public Fwd_Unfreeze( Task_ID )
  124. {
  125. new client = UNTASK_UNFREEZE( Task_ID );
  126.  
  127. message_begin( MSG_ONE, get_user_msgid("ScreenFade"), _, client);
  128. write_short( 0 );
  129. write_short( 0 );
  130. write_short( 0 );
  131. write_byte( 0 );
  132. write_byte( 0 );
  133. write_byte( 0 );
  134. write_byte( 0 );
  135. message_end( );
  136.  
  137. ice_entity( client, 0 );
  138.  
  139. g_bFreezed[ client ] = false;
  140.  
  141. engfunc( EngFunc_EmitSound, client, CHAN_WEAPON, szFrostSoundsPath[ Unfreeze ], 1.0, ATTN_NORM, 0, PITCH_NORM)
  142. }
  143.  
  144. public Event_NewRound()
  145. {
  146. for(new i = 0; i < get_maxplayers(); i++)
  147. {
  148. ice_entity( i, 0 )
  149. }
  150. }
  151.  
  152. public fnPlayerDead(id)
  153. {
  154. ice_entity( id, 0 )
  155. }
  156.  
  157.  
  158. public CmdExplodeBeacon( const g_iOrigin[3] )
  159. {
  160. message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  161. write_byte( TE_BEAMCYLINDER );
  162. write_coord( g_iOrigin[0] );
  163. write_coord( g_iOrigin[1] );
  164. write_coord( g_iOrigin[2] );
  165. write_coord( g_iOrigin[0] );
  166. write_coord( g_iOrigin[1] );
  167. write_coord( g_iOrigin[2] + 385);
  168. write_short( g_iBeaconSprite );
  169. write_byte(0);
  170. write_byte(0);
  171. write_byte(4);
  172. write_byte(60);
  173. write_byte(0);
  174. write_byte(40);
  175. write_byte(100);
  176. write_byte(200);
  177. write_byte(200);
  178. write_byte(0);
  179. message_end();
  180.  
  181. message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  182. write_byte( TE_BEAMCYLINDER );
  183. write_coord( g_iOrigin[0] );
  184. write_coord( g_iOrigin[1] );
  185. write_coord( g_iOrigin[2] );
  186. write_coord( g_iOrigin[0] );
  187. write_coord( g_iOrigin[1] );
  188. write_coord( g_iOrigin[2] + 470);
  189. write_short( g_iBeaconSprite );
  190. write_byte(0);
  191. write_byte(0);
  192. write_byte(4);
  193. write_byte(60);
  194. write_byte(0);
  195. write_byte(40);
  196. write_byte(100);
  197. write_byte(200);
  198. write_byte(200);
  199. write_byte(0);
  200. message_end();
  201.  
  202. message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  203. write_byte( TE_BEAMCYLINDER );
  204. write_coord( g_iOrigin[0] );
  205. write_coord( g_iOrigin[1] );
  206. write_coord( g_iOrigin[2] );
  207. write_coord( g_iOrigin[0] );
  208. write_coord( g_iOrigin[1] );
  209. write_coord( g_iOrigin[2] + 550);
  210. write_short( g_iBeaconSprite );
  211. write_byte(0);
  212. write_byte(0);
  213. write_byte(4);
  214. write_byte(60);
  215. write_byte(0);
  216. write_byte( 40 );
  217. write_byte( 100 );
  218. write_byte( 200 );
  219. write_byte( 200 );
  220. write_byte( 0 );
  221. message_end();
  222.  
  223. message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  224. write_byte( TE_EXPLOSION )
  225. write_coord( g_iOrigin[0] )
  226. write_coord( g_iOrigin[1] )
  227. write_coord( g_iOrigin[2] + 75 )
  228. write_short( g_iExplodeSprite )
  229. write_byte(22)
  230. write_byte(35)
  231. write_byte(TE_EXPLFLAG_NOSOUND)
  232. message_end()
  233. }
  234.  
  235. stock ice_entity( id, status )
  236. {
  237. if(status)
  238. {
  239. static ent, Float:o[3]
  240. if(!is_user_alive(id))
  241. {
  242. ice_entity( id, 0 )
  243. return
  244. }
  245.  
  246. if( is_valid_ent(iceent[id]) )
  247. {
  248. if( pev( iceent[id], pev_iuser3 ) != id )
  249. {
  250. if( pev(iceent[id], pev_team) == 6969 ) remove_entity(iceent[id])
  251. }
  252. else
  253. {
  254. pev( id, pev_origin, o )
  255. if( pev( id, pev_flags ) & FL_DUCKING ) o[2] -= 15.0
  256. else o[2] -= 35.0
  257. entity_set_origin(iceent[id], o)
  258. return
  259. }
  260. }
  261.  
  262. pev( id, pev_origin, o )
  263. if( pev( id, pev_flags ) & FL_DUCKING ) o[2] -= 15.0
  264. else o[2] -= 35.0
  265. ent = create_entity("info_target")
  266. set_pev( ent, pev_classname, "DareDevil" )
  267.  
  268. entity_set_model(ent, ice_model)
  269. dllfunc(DLLFunc_Spawn, ent)
  270. set_pev(ent, pev_solid, SOLID_BBOX)
  271. set_pev(ent, pev_movetype, MOVETYPE_FLY)
  272. entity_set_origin(ent, o)
  273. entity_set_size(ent, Float:{ -3.0, -3.0, -3.0 }, Float:{ 3.0, 3.0, 3.0 } )
  274. set_pev( ent, pev_iuser3, id )
  275. set_pev( ent, pev_team, 6969 )
  276. set_rendering(ent, kRenderFxNone, 255, 255, 255, kRenderTransAdd, 255)
  277. iceent[id] = ent
  278. }
  279. else
  280. {
  281. if( is_valid_ent(iceent[id]) )
  282. {
  283. if( pev(iceent[id], pev_team) == 6969 ) remove_entity(iceent[id])
  284. iceent[id] = -1
  285. }
  286. }
  287. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement