Advertisement
Guest User

xmas_bomb_events_without_points.sma (fara puncte)

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