Advertisement
Guest User

xmas_bomb_events.sma (cu puncte)

a guest
Sep 1st, 2022
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.16 KB | None | 0 0
  1.  
  2. /* Craciun Fericit! - Merry Christmas!
  3.  
  4. - Contact: csfweed01#0001 (Discord) - www.steamcommunity.com/id/csfweed01
  5.  
  6. */
  7.  
  8. #include < amxmodx >
  9. #include < amxmisc >
  10. #include < cstrike >
  11. #include < engine >
  12. #include < ColorChat >
  13. #include < fakemeta >
  14. #include < hamsandwich >
  15. #include < csx >
  16.  
  17. /*===========================================================================*/
  18.  
  19. new const PlantedSound[ ] = "xmas_reborn/xmas_bomb_planted.mp3";
  20. new const Model_C4[][] =
  21. {
  22. "models/xmas_reborn/v_c4.mdl",
  23. "models/xmas_reborn/p_c4.mdl"
  24. }
  25. new g_c4timer, pointnum;
  26. new bool:b_planted = false;
  27. new iEntity;
  28.  
  29. native get_user_points(id);
  30. native set_user_points(id, amount);
  31.  
  32. #define PLUGIN "Bomb EV [XMAS]"
  33. #define VERSION "1.1"
  34. #define AUTHOR "Akc3n7 + csfweed01"
  35.  
  36. #define GLOBURI 3
  37. #define ANIMATION_DEFUSE
  38. #define BLINK_BOMB
  39.  
  40. #if defined BLINK_BOMB
  41. #endif
  42.  
  43. new const gClassname_bomb[] = "bomb_snow"
  44.  
  45. new const g_szBombModels[][] = {
  46. "models/xmas_reborn/snowman.mdl"
  47. };
  48.  
  49. public plugin_init( ) {
  50.  
  51. register_plugin(PLUGIN, VERSION, AUTHOR);
  52.  
  53. pointnum = get_cvar_pointer("mp_c4timer");
  54. RegisterHam(Ham_Item_Deploy, "weapon_c4", "Ham_Item_Deploy_Post", 1);
  55.  
  56. register_logevent("logevent_newround", 2, "1=Round_Start");
  57. register_logevent("logevent_endround", 2, "1=Round_End");
  58. register_logevent("logevent_endround", 2, "1&Restart_Round_");
  59. register_logevent("logevent_defuseround", 3, "2=Defused_The_Bomb");
  60. register_event("HLTV", "eventHLTV", "a", "1=0", "2=0");
  61. register_forward(FM_SetModel, "fwd_SetModel", 1);
  62.  
  63. register_cvar("xmas_bomb_reborn", VERSION, FCVAR_SERVER | FCVAR_SPONLY);
  64. set_cvar_string("xmas_bomb_reborn", VERSION);
  65.  
  66. #if defined ANIMATION_DEFUSE
  67. register_event("BarTime", "_cansel", "b", "1=0")
  68. #endif
  69.  
  70. register_think(gClassname_bomb, "EntityThink")
  71. }
  72.  
  73. public plugin_precache( ) {
  74.  
  75. for( new i = 0; i < sizeof Model_C4; i++ )
  76. engfunc( EngFunc_PrecacheModel, Model_C4[i]);
  77. precache_sound(PlantedSound);
  78.  
  79. precache_model("models/hairt.mdl");
  80. new i;
  81. for(i = 0; i < sizeof g_szBombModels; i++)
  82. precache_model(g_szBombModels[i]);
  83.  
  84. for(i = 0 ; i < sizeof g_szBombModels ; i++)
  85. precache_model(g_szBombModels[i]);
  86. }
  87.  
  88. public eventHLTV()
  89. {
  90. clean()
  91. }
  92.  
  93. public EntityThink(iEntity)
  94. {
  95. if(!pev_valid(iEntity))
  96. return PLUGIN_CONTINUE
  97.  
  98. set_pev(iEntity, pev_nextthink, get_gametime() + 0.1)
  99.  
  100. return PLUGIN_CONTINUE
  101. }
  102.  
  103. public fwd_SetModel(ent, const szModel[])
  104. {
  105. if(!pev_valid(ent))
  106. return FMRES_IGNORED;
  107.  
  108. if(equal(szModel, "models/w_c4.mdl"))
  109. {
  110. engfunc(EngFunc_SetModel, ent, "models/hairt.mdl");
  111.  
  112. return FMRES_SUPERCEDE;
  113. }
  114. return FMRES_IGNORED;
  115. }
  116.  
  117. public clean()
  118. {
  119. new entity = -1;
  120.  
  121. while((entity = find_ent_by_class(entity, gClassname_bomb)))
  122. {
  123. remove_entity(entity);
  124. }
  125. }
  126.  
  127. public Ham_Item_Deploy_Post(ent)
  128. {
  129. static id;
  130. id = get_pdata_cbase( ent, 41, 4 )
  131.  
  132. if(!pev_valid(ent))
  133. return;
  134.  
  135. set_pev( id, pev_viewmodel2, Model_C4[0]);
  136. set_pev( id, pev_weaponmodel2, Model_C4[1]);
  137.  
  138. }
  139.  
  140. public logevent_newround( ) {
  141.  
  142. g_c4timer = 0;
  143. remove_task(652450);
  144. b_planted = false;
  145. }
  146.  
  147. public logevent_endround()
  148. {
  149. g_c4timer = 0;
  150. remove_task(652450);
  151. }
  152.  
  153. public logevent_defuseround()
  154. {
  155. if(pev_valid(iEntity)) __Anim(iEntity, 104, 1.0);
  156. }
  157.  
  158. public bomb_planted( Client ) {
  159.  
  160. PlaySoundToClients (PlantedSound);
  161. b_planted = true;
  162. c4timer();
  163.  
  164. new iOrigin[3]
  165. get_user_origin(Client, iOrigin, 0)
  166.  
  167. new Float:fOrigin[3]
  168. IVecFVec(iOrigin, fOrigin)
  169.  
  170. if( (pev(Client, pev_flags) & FL_ONGROUND) && (pev(Client, pev_button) & IN_DUCK ) )
  171. fOrigin[2] += 18.0;
  172.  
  173. iEntity = create_entity("info_target")
  174.  
  175. if(!pev_valid(iEntity))
  176. return PLUGIN_HANDLED
  177.  
  178. set_pev(iEntity, pev_origin, fOrigin)
  179.  
  180. set_pev(iEntity, pev_classname, gClassname_bomb)
  181. set_pev(iEntity, pev_solid, SOLID_NOT)
  182. set_pev(iEntity, pev_movetype, MOVETYPE_NONE)
  183. set_pev(iEntity, pev_sequence, 1)
  184. set_pev(iEntity, pev_framerate, 1.0)
  185. set_pev(iEntity, pev_nextthink, get_gametime() + 1.0)
  186.  
  187. engfunc(EngFunc_SetModel, iEntity, g_szBombModels[0])
  188. set_rendering(iEntity, kRenderFxGlowShell, random_num(0, 255), random_num(0, 255), random_num(0, 255), kRenderNormal, 16)
  189.  
  190. static Nume[32];
  191. get_user_name( Client, Nume, sizeof ( Nume ) -1 );
  192. g_c4timer = get_pcvar_num(pointnum);
  193. set_task(1.0, "c4timer", 652450, "", 0, "b");
  194.  
  195. set_hudmessage(115, 255, 0, -1.0, 0.3, 2, 1.1, 5.0, 0.0, 0.0)
  196. show_hudmessage(0, "Mosule, salveaza Craciunul !");
  197.  
  198. new rand = random_num(300, 800)
  199. cs_set_user_money(Client, cs_get_user_money(Client) + rand)
  200. set_user_points(Client, get_user_points(Client) + GLOBURI)
  201. ColorChat(0, GREEN, "^x04[^x01XMAS^x04]^x03 %s^x01 a primit^x01 %d^x04$^x01 +^x04 %d^x03 globuri^x01 pentru impodobirea bradului.", Nume, rand, GLOBURI);
  202.  
  203. return PLUGIN_HANDLED
  204.  
  205. /*==========================================================================================================*/
  206. }
  207.  
  208. public bomb_explode( Client ) {
  209.  
  210. static Nume[32];
  211. get_user_name( Client, Nume, sizeof ( Nume ) -1 );
  212. clean();
  213.  
  214. if(b_planted)
  215. {
  216. remove_task(652450);
  217. b_planted = false;
  218. }
  219.  
  220. new rand = random_num(300, 800)
  221. cs_set_user_money(Client, cs_get_user_money(Client) + rand)
  222. set_user_points(Client, get_user_points(Client) + GLOBURI)
  223. ColorChat(0, GREEN, "^x04[^x01XMAS^x04]^x03 %s^x01 a primit^x01 %d^x04$^x01 +^x04 %d^x03 globuri^x01 pentru ca a distrus craciunul.", Nume, rand, GLOBURI);
  224.  
  225. /*==========================================================================================================*/
  226. }
  227.  
  228. public bomb_defused( Client ) {
  229.  
  230. static Nume[32];
  231. get_user_name( Client, Nume, sizeof ( Nume ) -1 );
  232.  
  233. #if defined ANIMATION_DEFUSE
  234. if(pev_valid(iEntity)) __Anim(iEntity, 3, 1.0); //run
  235. #endif
  236.  
  237. if(b_planted)
  238. {
  239. remove_task(652450);
  240. b_planted = false;
  241. }
  242.  
  243. new rand = random_num(300, 800)
  244. cs_set_user_money(Client, cs_get_user_money(Client) + rand)
  245. set_user_points(Client, get_user_points(Client) + GLOBURI)
  246. ColorChat(0, GREEN, "^x04[^x01XMAS^x04]^x03 %s^x01 a primit^x01 %d^x04$^x01 +^x04 %d^x03 globuri^x01 pentru ca a salvat craciunul.", Nume, rand, GLOBURI);
  247. }
  248.  
  249. #if defined ANIMATION_DEFUSE
  250. public _cansel() {
  251.  
  252. if(pev_valid(iEntity)) __Anim(iEntity, 1, 1.0); //not run
  253. }
  254. #endif
  255.  
  256. public c4timer()
  257. {
  258. if(g_c4timer > 0)
  259. {
  260. g_c4timer --
  261.  
  262. set_dhudmessage(255, 0, 0, 0.05, 0.25, 2, 1.1, 1.1, 0.0, 0.0)
  263. show_dhudmessage(0, "Craciunul va fi distrus in: %d", g_c4timer);
  264. }
  265. else remove_task(652450);
  266. }
  267.  
  268. PlaySoundToClients ( const sound [ ] )
  269. {
  270. if ( equal ( sound [ strlen ( sound ) -4 ], ".mp3" ) )
  271. client_cmd ( 0, "mp3 play ^"sound/%s^"", sound );
  272. else
  273. client_cmd ( 0, "spk ^"%s^"", sound );
  274. }
  275. stock __Anim(index, sequence, Float: framerate = 1.0)
  276. {
  277. static className[32];
  278. entity_get_string(iEntity, EV_SZ_classname, className, charsmax(className))
  279. if(equali(className, gClassname_bomb) && pev_valid(index))
  280. {
  281. entity_set_float(index, EV_FL_animtime, get_gametime());
  282. entity_set_float(index, EV_FL_framerate, framerate);
  283. entity_set_float(index, EV_FL_frame, 0.0);
  284. entity_set_int(index, EV_INT_sequence, sequence);
  285. }
  286.  
  287. if(sequence == 104)
  288. {
  289. set_task(2.5, "clean")
  290. }
  291. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement