Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Craciun Fericit! - Merry Christmas!
- - Contact: csfweed01#0001 (Discord) - www.steamcommunity.com/id/csfweed01
- */
- #include < amxmodx >
- #include < amxmisc >
- #include < cstrike >
- #include < engine >
- #include < ColorChat >
- #include < fakemeta >
- #include < hamsandwich >
- #include < csx >
- /*===========================================================================*/
- new const PlantedSound[ ] = "xmas_reborn/xmas_bomb_planted.mp3";
- new const Model_C4[][] =
- {
- "models/xmas_reborn/v_c4.mdl",
- "models/xmas_reborn/p_c4.mdl"
- }
- new g_c4timer, pointnum;
- new bool:b_planted = false;
- new iEntity;
- native get_user_points(id);
- native set_user_points(id, amount);
- #define PLUGIN "Bomb EV [XMAS]"
- #define VERSION "1.1"
- #define AUTHOR "Akc3n7 + csfweed01"
- #define GLOBURI 3
- #define ANIMATION_DEFUSE
- #define BLINK_BOMB
- #if defined BLINK_BOMB
- #endif
- new const gClassname_bomb[] = "bomb_snow"
- new const g_szBombModels[][] = {
- "models/xmas_reborn/snowman.mdl"
- };
- public plugin_init( ) {
- register_plugin(PLUGIN, VERSION, AUTHOR);
- pointnum = get_cvar_pointer("mp_c4timer");
- RegisterHam(Ham_Item_Deploy, "weapon_c4", "Ham_Item_Deploy_Post", 1);
- register_logevent("logevent_newround", 2, "1=Round_Start");
- register_logevent("logevent_endround", 2, "1=Round_End");
- register_logevent("logevent_endround", 2, "1&Restart_Round_");
- register_logevent("logevent_defuseround", 3, "2=Defused_The_Bomb");
- register_event("HLTV", "eventHLTV", "a", "1=0", "2=0");
- register_forward(FM_SetModel, "fwd_SetModel", 1);
- register_cvar("xmas_bomb_reborn", VERSION, FCVAR_SERVER | FCVAR_SPONLY);
- set_cvar_string("xmas_bomb_reborn", VERSION);
- #if defined ANIMATION_DEFUSE
- register_event("BarTime", "_cansel", "b", "1=0")
- #endif
- register_think(gClassname_bomb, "EntityThink")
- }
- public plugin_precache( ) {
- for( new i = 0; i < sizeof Model_C4; i++ )
- engfunc( EngFunc_PrecacheModel, Model_C4[i]);
- precache_sound(PlantedSound);
- precache_model("models/hairt.mdl");
- new i;
- for(i = 0; i < sizeof g_szBombModels; i++)
- precache_model(g_szBombModels[i]);
- for(i = 0 ; i < sizeof g_szBombModels ; i++)
- precache_model(g_szBombModels[i]);
- }
- public eventHLTV()
- {
- clean()
- }
- public EntityThink(iEntity)
- {
- if(!pev_valid(iEntity))
- return PLUGIN_CONTINUE
- set_pev(iEntity, pev_nextthink, get_gametime() + 0.1)
- return PLUGIN_CONTINUE
- }
- public fwd_SetModel(ent, const szModel[])
- {
- if(!pev_valid(ent))
- return FMRES_IGNORED;
- if(equal(szModel, "models/w_c4.mdl"))
- {
- engfunc(EngFunc_SetModel, ent, "models/hairt.mdl");
- return FMRES_SUPERCEDE;
- }
- return FMRES_IGNORED;
- }
- public clean()
- {
- new entity = -1;
- while((entity = find_ent_by_class(entity, gClassname_bomb)))
- {
- remove_entity(entity);
- }
- }
- public Ham_Item_Deploy_Post(ent)
- {
- static id;
- id = get_pdata_cbase( ent, 41, 4 )
- if(!pev_valid(ent))
- return;
- set_pev( id, pev_viewmodel2, Model_C4[0]);
- set_pev( id, pev_weaponmodel2, Model_C4[1]);
- }
- public logevent_newround( ) {
- g_c4timer = 0;
- remove_task(652450);
- b_planted = false;
- }
- public logevent_endround()
- {
- g_c4timer = 0;
- remove_task(652450);
- }
- public logevent_defuseround()
- {
- if(pev_valid(iEntity)) __Anim(iEntity, 104, 1.0);
- }
- public bomb_planted( Client ) {
- PlaySoundToClients (PlantedSound);
- b_planted = true;
- c4timer();
- new iOrigin[3]
- get_user_origin(Client, iOrigin, 0)
- new Float:fOrigin[3]
- IVecFVec(iOrigin, fOrigin)
- if( (pev(Client, pev_flags) & FL_ONGROUND) && (pev(Client, pev_button) & IN_DUCK ) )
- fOrigin[2] += 18.0;
- iEntity = create_entity("info_target")
- if(!pev_valid(iEntity))
- return PLUGIN_HANDLED
- set_pev(iEntity, pev_origin, fOrigin)
- set_pev(iEntity, pev_classname, gClassname_bomb)
- set_pev(iEntity, pev_solid, SOLID_NOT)
- set_pev(iEntity, pev_movetype, MOVETYPE_NONE)
- set_pev(iEntity, pev_sequence, 1)
- set_pev(iEntity, pev_framerate, 1.0)
- set_pev(iEntity, pev_nextthink, get_gametime() + 1.0)
- engfunc(EngFunc_SetModel, iEntity, g_szBombModels[0])
- set_rendering(iEntity, kRenderFxGlowShell, random_num(0, 255), random_num(0, 255), random_num(0, 255), kRenderNormal, 16)
- static Nume[32];
- get_user_name( Client, Nume, sizeof ( Nume ) -1 );
- g_c4timer = get_pcvar_num(pointnum);
- set_task(1.0, "c4timer", 652450, "", 0, "b");
- set_hudmessage(115, 255, 0, -1.0, 0.3, 2, 1.1, 5.0, 0.0, 0.0)
- show_hudmessage(0, "Mosule, salveaza Craciunul !");
- new rand = random_num(300, 800)
- cs_set_user_money(Client, cs_get_user_money(Client) + rand)
- set_user_points(Client, get_user_points(Client) + GLOBURI)
- 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);
- return PLUGIN_HANDLED
- /*==========================================================================================================*/
- }
- public bomb_explode( Client ) {
- static Nume[32];
- get_user_name( Client, Nume, sizeof ( Nume ) -1 );
- clean();
- if(b_planted)
- {
- remove_task(652450);
- b_planted = false;
- }
- new rand = random_num(300, 800)
- cs_set_user_money(Client, cs_get_user_money(Client) + rand)
- set_user_points(Client, get_user_points(Client) + GLOBURI)
- 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);
- /*==========================================================================================================*/
- }
- public bomb_defused( Client ) {
- static Nume[32];
- get_user_name( Client, Nume, sizeof ( Nume ) -1 );
- #if defined ANIMATION_DEFUSE
- if(pev_valid(iEntity)) __Anim(iEntity, 3, 1.0); //run
- #endif
- if(b_planted)
- {
- remove_task(652450);
- b_planted = false;
- }
- new rand = random_num(300, 800)
- cs_set_user_money(Client, cs_get_user_money(Client) + rand)
- set_user_points(Client, get_user_points(Client) + GLOBURI)
- 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);
- }
- #if defined ANIMATION_DEFUSE
- public _cansel() {
- if(pev_valid(iEntity)) __Anim(iEntity, 1, 1.0); //not run
- }
- #endif
- public c4timer()
- {
- if(g_c4timer > 0)
- {
- g_c4timer --
- set_dhudmessage(255, 0, 0, 0.05, 0.25, 2, 1.1, 1.1, 0.0, 0.0)
- show_dhudmessage(0, "Craciunul va fi distrus in: %d", g_c4timer);
- }
- else remove_task(652450);
- }
- PlaySoundToClients ( const sound [ ] )
- {
- if ( equal ( sound [ strlen ( sound ) -4 ], ".mp3" ) )
- client_cmd ( 0, "mp3 play ^"sound/%s^"", sound );
- else
- client_cmd ( 0, "spk ^"%s^"", sound );
- }
- stock __Anim(index, sequence, Float: framerate = 1.0)
- {
- static className[32];
- entity_get_string(iEntity, EV_SZ_classname, className, charsmax(className))
- if(equali(className, gClassname_bomb) && pev_valid(index))
- {
- entity_set_float(index, EV_FL_animtime, get_gametime());
- entity_set_float(index, EV_FL_framerate, framerate);
- entity_set_float(index, EV_FL_frame, 0.0);
- entity_set_int(index, EV_INT_sequence, sequence);
- }
- if(sequence == 104)
- {
- set_task(2.5, "clean")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement