Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <engine>
- #include <hamsandwich>
- #include <fakemeta_util>
- #include <dhudmessage>
- #include <zombieplague>
- // *** НаŃтройки *** //
- #define NAME "AIR \rStrike" // Nume˛ Extra items
- #define COST 500 // Pret˛ Extra items
- #define COUNT 2 // De cate ori se poate cumpara pe runda
- #define DAMAGE 99990 // Damage de o bomba
- #define RELOADING 60 // Reincarcare in secunde
- #define TIMER 5 // Timpul de asteptare in secunde
- #define DEATHMSG // Schimba icoana la omor în col?ul din dreapta sus? (Dacă nu, ?terge?i această linie)
- #define CLASSNAME "air_rocket228"
- #define ROCKET_MODEL "models/air_rocket.mdl"
- #define LAUNCH_SOUND "launch_rockets.wav"
- #define LAUNCH_BEEP "launch_beep.wav"
- #define DMG_HEGRENADE (1<<24)
- #define TASK_HUD 981623
- new const Float:g_fOffsetCoord[9][2] =
- {
- {0.0, 0.0},
- {-100.0, -100.0},
- {100.0, 100.0},
- {-100.0, 100.0},
- {100.0, -100.0},
- {0.0, 160.0},
- {0.0, -160.0},
- {160.0, 0.0},
- {-160.0, 0.0}
- }
- new g_iSprExp, g_iSprTrail, g_iSprShockWave
- new g_iTimer, Float:g_fBlockBuy, g_iBlockBuyCount[33], Float:g_fCentreOrigin[3]
- new g_iMaxPlayers, g_iItem
- #if defined DEATHMSG
- new HamHook:g_iHamHookKilledPost
- #endif
- public plugin_init()
- {
- register_plugin("[ZP] Air Strike", "1.0", "Dorus")
- register_event("HLTV", "NewRound", "a", "1=0", "2=0")
- register_touch(CLASSNAME, "*", "fw_RocketTouch")
- RegisterHam(Ham_Think, "info_target", "Ham_HookThink")
- #if defined DEATHMSG
- register_message(get_user_msgid("DeathMsg"), "Msg_DeathMsg")
- DisableHamForward((g_iHamHookKilledPost = RegisterHam(Ham_Killed, "player", "Ham_Killed_Post", 1)))
- #endif
- g_iItem = zp_register_extra_item(NAME, COST, ZP_TEAM_HUMAN)
- g_iMaxPlayers = get_maxplayers()
- g_fBlockBuy = get_gametime()
- }
- public plugin_precache()
- {
- precache_sound(LAUNCH_SOUND)
- precache_sound(LAUNCH_BEEP)
- precache_model(ROCKET_MODEL)
- g_iSprExp = precache_model("sprites/zerogxplode.spr")
- g_iSprTrail = precache_model("sprites/xbeam3.spr")
- g_iSprShockWave = precache_model("sprites/shockwave.spr")
- }
- public client_putinserver(id)
- {
- g_iBlockBuyCount[id] = COUNT
- }
- public zp_extra_item_selected(id, iItemid)
- {
- if(iItemid == g_iItem)
- {
- if(!is_user_alive(id) || zp_get_user_zombie(id))
- return PLUGIN_HANDLED
- if(g_iBlockBuyCount[id] < 1)
- {
- ChatColor(id, "TEST 1 !y[!tĐвиаŃĐ´Đ°Ń€!y] Можно покŃпать !g%d раз(Đ°) !yĐ·Đ° раŃнд", COUNT)
- client_print(id, print_center, "You use all. Limit per Round %d", COUNT)
- return ZP_PLUGIN_HANDLED
- }
- if(g_fBlockBuy > get_gametime())
- {
- ChatColor(id, "!y[!tAir Strike!y] Time Left to recharge !g%d second !y", floatround(g_fBlockBuy - get_gametime()))
- client_print(id, print_center, "Time left to recharge Air Strike [ %d ] second ", floatround(g_fBlockBuy - get_gametime()))
- return ZP_PLUGIN_HANDLED
- }
- fm_get_aim_origin(id, g_fCentreOrigin)
- g_iTimer = TIMER
- LaunchDHud(id+TASK_HUD)
- new szName[32]
- get_user_name(id, szName, charsmax(szName))
- ChatColor(id, "!y[!tATENTIE !y] Sergent !g%s !yLaunch the Air Strike", szName)
- g_fBlockBuy = get_gametime() + float(RELOADING) + TIMER
- g_iBlockBuyCount[id]--
- }
- return PLUGIN_HANDLED
- }
- public NewRound()
- {
- for(new id = 1; id <= g_iMaxPlayers; id++)
- {
- if(task_exists(id+TASK_HUD))
- remove_task(id+TASK_HUD)
- }
- static iEnt
- iEnt = -1
- while((iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", CLASSNAME)))
- {
- if(is_valid_ent(iEnt))
- engfunc(EngFunc_RemoveEntity, iEnt)
- }
- arrayset(g_iBlockBuyCount, COUNT, sizeof(g_iBlockBuyCount))
- g_fBlockBuy = get_gametime()
- }
- public LaunchDHud(iTask)
- {
- static id
- id = iTask - TASK_HUD
- if(g_iTimer <= 0)
- {
- set_dhudmessage(255, 0, 0, -1.0, 0.40, 0, 1.0, 1.5, 0.1, 0.2)
- show_dhudmessage(0, "TEST 6 WARNING !!! ^n Air Strike is Activated.")
- g_iTimer = TIMER
- LaunchRocket(id)
- }
- else
- {
- set_dhudmessage(255, 0, 0, -1.0, 0.40, 0, 1.0, 0.9, 0.1, 0.2)
- show_dhudmessage(0, "Time Left launch Air:^n%d second", g_iTimer--)
- set_task(1.0, "LaunchDHud", id+TASK_HUD)
- emit_sound(0, CHAN_VOICE, LAUNCH_BEEP, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
- CreateBeamCylinder(g_fCentreOrigin, g_iSprShockWave, 200.0, 10, 10, 255, 0, 0, 100)
- }
- }
- public LaunchRocket(id)
- {
- static iEnt, Float:tmp_fVelocity[3] = {0.0, 0.0, 0.0}
- new Float:tmp_fNewOrigin[3], Float:fRoofOrigin[3]
- emit_sound(id, CHAN_VOICE, LAUNCH_SOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
- for(new i = 0; i < 9; i++)
- {
- tmp_fNewOrigin[0] = g_fCentreOrigin[0] + g_fOffsetCoord[i][0]
- tmp_fNewOrigin[1] = g_fCentreOrigin[1] + g_fOffsetCoord[i][1]
- tmp_fNewOrigin[2] = g_fCentreOrigin[2]
- iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
- if(!pev_valid(iEnt))
- return
- fRoofOrigin = get_origin_to_roof(iEnt, tmp_fNewOrigin)
- fRoofOrigin[2] -= random_float(0.0, 50.0)
- engfunc(EngFunc_SetModel, iEnt, ROCKET_MODEL)
- set_pev(iEnt, pev_solid, SOLID_TRIGGER)
- set_pev(iEnt, pev_movetype, MOVETYPE_FLY)
- set_pev(iEnt, pev_size, Float:{-1.0, -1.0, -1.0}, Float:{1.0, 1.0, 5.0})
- tmp_fVelocity[2] = random_float(-500.0, -450.0)
- set_pev(iEnt, pev_velocity, tmp_fVelocity)
- set_pev(iEnt, pev_classname, CLASSNAME)
- set_pev(iEnt, pev_origin, fRoofOrigin)
- set_pev(iEnt, pev_owner, id)
- set_pev(iEnt, pev_nextthink, get_gametime() + 0.5)
- }
- }
- public Ham_HookThink(iEnt)
- {
- if(!pev_valid(iEnt))
- return HAM_IGNORED
- new szClassName[64]
- pev(iEnt, pev_classname, szClassName, charsmax(szClassName))
- if(!equal(szClassName, CLASSNAME))
- return HAM_IGNORED
- CreateBeamFollow(iEnt, g_iSprTrail, 10, 5, 255, 255, 255, 255)
- set_pev(iEnt, pev_nextthink, 0)
- return HAM_IGNORED
- }
- public fw_RocketTouch(iEnt, iTouch)
- {
- if(!pev_valid(iEnt))
- return
- static Float:fOrigin[3], iOwner
- pev(iEnt, pev_origin, fOrigin)
- iOwner = pev(iEnt, pev_owner)
- CreateExplosion(fOrigin, g_iSprExp, 30, 30, 0)
- CreateBeamCylinder(fOrigin, g_iSprShockWave, 70.0, 6, 30, 248, 255, 175, 100)
- new iVictim = -1
- while((iVictim = find_ent_in_sphere(iVictim, fOrigin, 200.0)) != 0)
- {
- if(!is_user_alive(iVictim) || !zp_get_user_zombie(iVictim))
- continue
- ExecuteHamB(Ham_TakeDamage, iVictim, iEnt, iOwner, float(DAMAGE), DMG_HEGRENADE)
- }
- engfunc(EngFunc_RemoveEntity, iEnt)
- }
- #if defined DEATHMSG
- public Msg_DeathMsg()
- {
- new iAttacker = get_msg_arg_int(1)
- new szClassName[16], szName[32], szBuffer[64]
- get_msg_arg_string(4, szClassName, charsmax(szClassName))
- get_user_name(iAttacker, szName, charsmax(szName))
- if(equal(szClassName, CLASSNAME))
- {
- formatex(szBuffer, charsmax(szBuffer), "%s (ĐвиаŃĐ´Đ°Ń€)", szName)
- set_user_fake_name(iAttacker, szBuffer)
- EnableHamForward(g_iHamHookKilledPost)
- set_msg_arg_string(4, "teammate")
- }
- }
- public Ham_Killed_Post(iVictim, iAttacker, iGib)
- {
- DisableHamForward(g_iHamHookKilledPost)
- reset_user_info(iAttacker)
- dllfunc(DLLFunc_ClientUserInfoChanged, iAttacker, engfunc(EngFunc_GetInfoKeyBuffer, iAttacker))
- }
- stock reset_user_info(iPlayer)
- {
- new szUserInfo[256]
- copy_infokey_buffer(engfunc(EngFunc_GetInfoKeyBuffer, iPlayer), szUserInfo, charsmax(szUserInfo))
- message_begin(MSG_ALL, SVC_UPDATEUSERINFO)
- write_byte(iPlayer - 1)
- write_long(get_user_userid(iPlayer))
- write_string(szUserInfo)
- write_long(0)
- write_long(0)
- write_long(0)
- write_long(0)
- message_end()
- }
- stock set_user_fake_name(iPlayer, szName[])
- {
- message_begin(MSG_ALL, SVC_UPDATEUSERINFO)
- write_byte(iPlayer - 1)
- write_long(get_user_userid(iPlayer))
- write_char('\')
- write_char('n')
- write_char('a')
- write_char('m')
- write_char('e')
- write_char('\')
- write_string(szName)
- for(new i; i < 16; i++) write_byte(0)
- message_end()
- }
- #endif
- stock Float:get_origin_to_roof(iEnt, Float:fStart[])
- {
- new Float:fDest[3] = {0.0, 0.0, 9999.0}
- xs_vec_add(fStart, fDest, fDest)
- engfunc(EngFunc_TraceLine, fStart, fDest, 0, iEnt, 0)
- new Float:fOrigin[3]
- get_tr2(0, TR_vecEndPos, fOrigin)
- return fOrigin
- }
- stock CreateExplosion(Float:fOrigin[], iSprite, iScale, iFramerate, iFlags)
- {
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
- write_byte(TE_EXPLOSION)
- engfunc(EngFunc_WriteCoord, fOrigin[0])
- engfunc(EngFunc_WriteCoord, fOrigin[1])
- engfunc(EngFunc_WriteCoord, fOrigin[2])
- write_short(iSprite)
- write_byte(iScale)
- write_byte(iFramerate)
- write_byte(iFlags)
- message_end()
- }
- stock CreateBeamFollow(iEnt, iSprite, iLife, iWidth, iRed, iGreen, iBlue, iBrightness)
- {
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
- write_byte(TE_BEAMFOLLOW)
- write_short(iEnt)
- write_short(iSprite)
- write_byte(iLife)
- write_byte(iWidth)
- write_byte(iRed)
- write_byte(iGreen)
- write_byte(iBlue)
- write_byte(iBrightness)
- message_end()
- }
- stock CreateBeamCylinder(Float:fOrigin[3], iSprite, Float:fRadius, iLife, iWidth, iRed, iGreen, iBlue, iBrightness)
- {
- engfunc(EngFunc_MessageBegin, MSG_BROADCAST, SVC_TEMPENTITY, fOrigin, 0)
- write_byte(TE_BEAMCYLINDER)
- engfunc(EngFunc_WriteCoord, fOrigin[0])
- engfunc(EngFunc_WriteCoord, fOrigin[1])
- engfunc(EngFunc_WriteCoord, fOrigin[2])
- engfunc(EngFunc_WriteCoord, fOrigin[0])
- engfunc(EngFunc_WriteCoord, fOrigin[1])
- engfunc(EngFunc_WriteCoord, fOrigin[2]+fRadius)
- write_short(iSprite)
- write_byte(0) // start framerate
- write_byte(0) // framerate
- write_byte(iLife)
- write_byte(iWidth)
- write_byte(0) // amplitude
- write_byte(iRed)
- write_byte(iGreen)
- write_byte(iBlue)
- write_byte(iBrightness)
- write_byte(0) // speed
- message_end()
- }
- stock ChatColor(const id, const szInput[], any:...)
- {
- new iCount = 1, iPlayers[32]
- static szMsg[191]
- vformat(szMsg, 190, szInput, 3)
- replace_all(szMsg, 190, "!g", "^4") // Зелёный
- replace_all(szMsg, 190, "!y", "^1") // Стандартный
- replace_all(szMsg, 190, "!t", "^3") // Цвет команды
- if(id) iPlayers[0] = id; else get_players(iPlayers, iCount, "ch")
- {
- for(new i = 0; i < iCount; i++)
- {
- if(is_user_connected(iPlayers[i]))
- {
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, iPlayers[i])
- write_byte(iPlayers[i]);
- write_string(szMsg);
- message_end();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement