|
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
|

02-11-2017
, 14:16
Re: Orpheu Functions | Read File | Multijump | Rocket | Random Players
|
#8
|
3.
PHP Code:
/* To do:
T = needs testing X = done - = cancelled
[T] CZ bots support v0.1.2 [ ] */
// Modules #include <amxmodx> #include <engine> #include <hamsandwich>
// Plug-in APIs #include <cs_ham_bots_api> #include <zombieplaguenightmare>
new g_pCvarJumpsMax, g_pCvarJumpsMaxResetBitsum, g_pCvarJumpsVelocity, g_iItemID, g_bEscapeMap, g_iJumps[33], g_iJumpsMax[33];
public plugin_init() { register_plugin("[ZPNM] Item: MultiJump", "0.1.2", "twistedeuphoria, Dabbi, B!gBud, D i 5 7 i n c T") register_event("HLTV", "fw_EventRoundStart", "a", "1=0", "2=0") RegisterHam(Ham_Spawn, "player", "fw_HamPlayerSpawn_Post", 1) RegisterHam(Ham_Player_Jump, "player", "fw_HamPlayerJump_Post", 1) RegisterHam(Ham_Killed, "player", "fw_HamPlayerKilled_Post", 1) RegisterHamBots(Ham_Spawn, "fw_HamPlayerSpawn_Post", 1) RegisterHamBots(Ham_Player_Jump, "fw_HamPlayerJump_Post", 1) RegisterHamBots(Ham_Killed, "fw_HamPlayerKilled_Post", 1) g_pCvarJumpsMax = register_cvar("zpnm_jumps_max", "1"); g_pCvarJumpsMaxResetBitsum = register_cvar("zpnm_jumps_max_reset", "172"); g_pCvarJumpsVelocity = register_cvar("zpnm_jumps_velocity", "265.0"); g_iItemID = zp_register_extra_item("Multi-jump \y(\w+1\y)", 5, ZP_TEAM_HUMAN | ZP_TEAM_SURVIVOR | ZP_TEAM_SNIPER | ZP_TEAM_ZOMBIE | ZP_TEAM_ASSASSIN); new szMapName[32]; get_mapname(szMapName, 31) if (containi(szMapName, "escape") != -1 || containi(szMapName, "ze_") != -1 || containi(szMapName, "atix") != -1) g_bEscapeMap = true; }
public fw_EventRoundStart() { if (!(get_pcvar_num(g_pCvarJumpsMaxResetBitsum) & 1)) return; static iMaxPlayers; if (!iMaxPlayers) iMaxPlayers = get_maxplayers(); for (new iID = 1; iID <= iMaxPlayers; iID++) LoseItem(iID) }
public client_disconnect(iID) LoseItem(iID)
public fw_HamPlayerSpawn_Post(iID) { if (get_pcvar_num(g_pCvarJumpsMaxResetBitsum) & 2) LoseItem(iID) }
public zp_extra_item_selected(iID, iItemID) { if (iItemID != g_iItemID) return PLUGIN_CONTINUE; if (g_bEscapeMap)// && !(get_user_flags(iID) & ADMIN_RCON) { colored_chat(iID, "^3Multi-jumps are restricted on escape maps^1!") return ZP_PLUGIN_HANDLED; } else if (g_iJumpsMax[iID] == get_pcvar_num(g_pCvarJumpsMax)) { colored_chat(iID, "^3You already have the maximum amount of multi-jumps^1(^3%d^1)!", g_iJumpsMax[iID]) return ZP_PLUGIN_HANDLED; } g_iJumps[iID]++ g_iJumpsMax[iID]++ colored_chat(iID, "^4You can now jump^1 %d^4 time(s) in mid-air^1.", g_iJumpsMax[iID]) return PLUGIN_CONTINUE; }
public fw_HamPlayerJump_Post(iID) { if (!g_iJumpsMax[iID]) return; if (entity_get_int(iID, EV_INT_flags) & FL_ONGROUND) { g_iJumps[iID] = g_iJumpsMax[iID]; return; } if (!g_iJumps[iID] || entity_get_int(iID, EV_INT_oldbuttons) & IN_JUMP) return; static Float:vVelocity[3]; entity_get_vector(iID, EV_VEC_velocity, vVelocity) vVelocity[2] = get_pcvar_float(g_pCvarJumpsVelocity); entity_set_vector(iID, EV_VEC_velocity, vVelocity) g_iJumps[iID]--; }
public zp_user_infected_pre(iID, iInfectorID, bNemesis, bAssassin) { if (zp_get_user_zombie(iID)) return; new iJumpsMaxResetBitsum = get_pcvar_num(g_pCvarJumpsMaxResetBitsum); if (!bAssassin && (!bNemesis && iJumpsMaxResetBitsum & 8 || bNemesis && iJumpsMaxResetBitsum & 32) || bAssassin && iJumpsMaxResetBitsum & 128) LoseItem(iID) }
public zp_user_humanized_pre(iID, bSurvivor, bSniper) { if (!zp_get_user_zombie(iID)) return; new iJumpsMaxResetBitsum = get_pcvar_num(g_pCvarJumpsMaxResetBitsum); if (!bSniper && (!bSurvivor && iJumpsMaxResetBitsum & 16 || bSurvivor && iJumpsMaxResetBitsum & 64) || bSniper && iJumpsMaxResetBitsum & 256) LoseItem(iID) }
public fw_HamPlayerKilled_Post(iID) { if (get_pcvar_num(g_pCvarJumpsMaxResetBitsum) & 4) LoseItem(iID) }
LoseItem(const iID) { if (!g_iJumpsMax[iID]) return; g_iJumps[iID] = 0; g_iJumpsMax[iID] = 0; colored_chat(iID, "^3You have lost your multi-jumps^1!") }
stock colored_chat(const iTarget, const szMessage[], any:...) { if (!is_user_connected(iTarget)) return; static szBuffer[192]; // Format message for player vformat(szBuffer, 191, szMessage, 3) new const D7_CHAT_TAG[] = "^1[^4ZPNM^1] " format(szBuffer, 191, "%s%s", D7_CHAT_TAG, szBuffer) static msgSayText; if (!msgSayText) msgSayText = get_user_msgid("SayText"); message_begin(MSG_ONE, msgSayText, _, iTarget) write_byte(iTarget) write_string(szBuffer) message_end() }
4.
PHP Code:
/* To do:
T = needs testing X = done - = cancelled
[X] damageable entities that get hit take full damage [T] make rockets not collide with other team rockets? [T] make rockets not collide with non-solid entities? [T] fix error log generated on invalid touched entity [T] increase range in EngFunc_FindEntityInSphere [T] make rockets destroy any damageable entity from other teams [T] ignore cases where damage <= 0.0 instead of checking for distance [T] make sure rockets don't destroy each other in case they're same team rockets [T] emessage instead of message for death for more compatibility with other plugins [T] rocket class name [T] remove entities by class name [T] ftFMEntityOriginGet model check [T] user rpg class name on death message [T] separate touched entity damage code [T] make sure the player takes the full damage, then kill him [T] only kill the player if he actually died from the rocket damage [T] add support for damage modification by external sources [T] get_user_team instead of cs_get_user_team [T] fix crash related to when touching a trigger_multiple(or any other solid_trigger?) entity [ ] see why it is happening [T] float velocity_by_aim [ ] map entities can have studio models too... [-] only kill the player if the remaining hp is 1.0, otherwise restore old hp [ ] cache as many things as possible and see if it increases touch rate [ ] explode rocket after X time if it doesn't hit anything [ ] */
#include <amxmodx> //#include <cstrike> #include <fakemeta> #include <hamsandwich>
#include <cs_ham_bots_api>
#include <bitsums> #include <D7Debug>
enum { g_iIDModHL, g_iIDModCS, g_iIDModDOD }
new g_iBsHasBazooka, g_iBsCanShoot, g_iBsConnected, g_iBsAlive, g_iIDPCVarSvMaxVelocity;
const g_iIDEntityRocketPev = pev_iuser4; const g_iIDEntityRocket = 7575;
new const g_szClassNameRocket[] = "D7RPG";
new const g_szEntityRocketModel[] = "models/rpgrocket.mdl"; new const ROCKET_SOUND[] = "weapons/rocketfire1.wav";
new g_iIDCacheSpriteRocketTrail, explosion, white;
new CVar_RocketDelay, CVar_RocketSpeed, CVar_RocketDmg, CVar_Dmg_range;
new g_iMaxPlayers, g_iIDMsgDeath, g_iIDMod;
public plugin_precache() { precache_model(g_szEntityRocketModel) g_iIDCacheSpriteRocketTrail = precache_model("sprites/smoke.spr"); explosion = precache_model("sprites/zerogxplode.spr") white = precache_model("sprites/white.spr") precache_sound(ROCKET_SOUND) }
public plugin_init() { register_plugin("D7 API RPG", "0.2.0", "D i 5 7 i n c T") RegisterHam(Ham_Spawn, "player", "fwHamSpawnPlayer", 1) RegisterHamBots(Ham_Spawn, "fwHamSpawnPlayer", 1) //RegisterHam(Ham_TakeDamage, "player", "fwHamTakeDamagePlayerPre") //RegisterHamBots(Ham_TakeDamage, "fwHamTakeDamagePlayerPre") //RegisterHam(Ham_TakeDamage, "player", "fwHamTakeDamagePlayer", 1) //RegisterHamBots(Ham_TakeDamage, "fwHamTakeDamagePlayer", 1) RegisterHam(Ham_Killed, "player", "fwHamKilledPlayerPre") RegisterHamBots(Ham_Killed, "fwHamKilledPlayerPre") register_forward(FM_Touch, "fwFmTouch", 1) register_forward(FM_PlayerPreThink, "fwFmPlayerPreThink", 1) register_clcmd("say /b", "fwClCmdSayB") g_iIDPCVarSvMaxVelocity = get_cvar_pointer("sv_maxvelocity"); CVar_RocketDelay = register_cvar("D7RPGDelay", "0.1") CVar_RocketSpeed = register_cvar("D7RPGSpeed", "970") CVar_RocketDmg = register_cvar("D7RPGDamage", "5") CVar_Dmg_range = register_cvar("D7RPGDamageRadius", "240") g_iMaxPlayers = get_maxplayers(); g_iIDMsgDeath = get_user_msgid("DeathMsg"); //register_message(g_iIDMsgDeath, "fwMsgDeathPre") new szModName[32]; get_modname(szModName, charsmax(szModName)); if (equali(szModName, "cstrike") || equali(szModName, "czero") || equali(szModName, "csv15") || equali(szModName, "cs13")) g_iIDMod = g_iIDModCS; else if (equali(szModName, "dod")) g_iIDMod = g_iIDModDOD; else g_iIDMod = g_iIDModHL; } /* // After fwHamKilledPlayerPre // Before fwHamKilledPlayer public fwMsgDeathPre(const iIDMsg, const iMsgDest, const iIDEnt) { new iIDAttacker = get_msg_arg_int(1), iIDVictim = get_msg_arg_int(2); ftD7Log(_, _, "[fwMsgDeathPre] iIDAttacker: %d. iIDVictim: %d.", iIDAttacker, iIDVictim) }*/
ftEntityRocketRemove(const iIDOwner = 0) { new iIDEntity = -1; //while ((iIDEntity = engfunc(EngFunc_FindEntityInSphere, iIDEntity, Float:{ 0.0, 0.0, 0.0 }, 99999.0)) != 0) while ((iIDEntity = engfunc(EngFunc_FindEntityByString, iIDEntity, "classname", g_szClassNameRocket)) != 0) { if (!pev_valid(iIDEntity) //|| pev(iIDEntity, g_iIDEntityRocketPev) != g_iIDEntityRocket || iIDOwner && iIDOwner != pev(iIDEntity, pev_owner)) continue; engfunc(EngFunc_RemoveEntity, iIDEntity) } }
public client_putinserver(iID) { bitsum_add(g_iBsConnected, iID) }
public client_disconnect(iID) { ftEntityRocketRemove(iID) remove_task(iID) bitsum_del(g_iBsHasBazooka, iID) bitsum_del(g_iBsCanShoot, iID) bitsum_del(g_iBsConnected, iID) bitsum_del(g_iBsAlive, iID) }
public fwHamSpawnPlayer(const iID) { //remove_task(iID) //bitsum_del(g_iBsHasBazooka, iID) //bitsum_del(g_iBsCanShoot, iID) if (!is_user_alive(iID)) return; bitsum_add(g_iBsAlive, iID) }
public fwHamKilledPlayerPre(const iID) { remove_task(iID) bitsum_del(g_iBsHasBazooka, iID) bitsum_del(g_iBsCanShoot, iID) bitsum_del(g_iBsAlive, iID) }
public fwClCmdSayB(const iID) { if (!bitsum_get(g_iBsHasBazooka, iID)) { bitsum_add(g_iBsHasBazooka, iID) fwTaskCanShoot(iID) } else { ftEntityRocketRemove(iID) remove_task(iID) bitsum_del(g_iBsHasBazooka, iID) bitsum_del(g_iBsCanShoot, iID) } } /* new g_iBsDeath;
public fwHamTakeDamagePlayerPre(const iIDEntity, const iIDInflictor, const iIDAttacker, Float:fDamage, const iBsDamageType) { if (iBsDamageType != DMG_BLAST) { ftD7Log(_, _, "[fwHamTakeDamagePlayerPre] iIDEntity: %d. iIDInflictor: %d. iIDAttacker: %d. Damage type is not DMG_BLAST.", iIDEntity, iIDInflictor, iIDAttacker) return; } else if (GetHamReturnStatus() == HAM_SUPERCEDE) { ftD7Log(_, _, "[fwHamTakeDamagePlayerPre] iIDEntity: %d. iIDInflictor: %d. iIDAttacker: %d. Damage has been blocked.", iIDEntity, iIDInflictor, iIDAttacker) return; } else if (!pev_valid(iIDInflictor)) { ftD7Log(_, _, "[fwHamTakeDamagePlayerPre] iIDEntity: %d. iIDInflictor: %d. iIDAttacker: %d. Inflictor is invalid.", iIDEntity, iIDInflictor, iIDAttacker) return; } else if (pev(iIDInflictor, g_iIDEntityRocketPev) != g_iIDEntityRocket) { ftD7Log(_, _, "[fwHamTakeDamagePlayerPre] iIDEntity: %d. iIDInflictor: %d. iIDAttacker: %d. Inflictor is not a rocket.", iIDEntity, iIDInflictor, iIDAttacker) return; } else if (get_user_health(iIDEntity) - floatround(fDamage, floatround_floor) > 0) { ftD7Log(_, _, "[fwHamTakeDamagePlayerPre] iIDEntity: %d. iIDInflictor: %d. iIDAttacker: %d. Health: %d. Damage: %d. NOT a kill.", iIDEntity, iIDInflictor, iIDAttacker, get_user_health(iIDEntity), floatround(fDamage, floatround_floor)) return; } //ftD7Log(_, _, "[fwHamTakeDamagePlayerPre] iIDEntity: %d. iIDInflictor: %d. iIDAttacker: %d. Health: %d. Damage: %d. KILL.", iIDEntity, iIDInflictor, iIDAttacker, get_user_health(iIDEntity), floatround(fDamage, floatround_floor)) bitsum_add(g_iBsDeath, iIDEntity) set_pev(iIDEntity, pev_health, fDamage + 1.0) }
public fwHamTakeDamagePlayer(const iIDEntity, const iIDInflictor, const iIDAttacker, Float:fDamage, const iBsDamageType) { if (iBsDamageType != DMG_BLAST) { //ftD7Log(_, _, "[fwHamTakeDamagePlayer] iIDEntity: %d. iIDInflictor: %d. iIDAttacker: %d. Damage type is not DMG_BLAST.", iIDEntity, iIDInflictor, iIDAttacker) return; } else if (GetHamReturnStatus() == HAM_SUPERCEDE) { //ftD7Log(_, _, "[fwHamTakeDamagePlayer] iIDEntity: %d. iIDInflictor: %d. iIDAttacker: %d. Damage has been blocked.", iIDEntity, iIDInflictor, iIDAttacker) return; } else if (!pev_valid(iIDInflictor)) { //ftD7Log(_, _, "[fwHamTakeDamagePlayer] iIDEntity: %d. iIDInflictor: %d. iIDAttacker: %d. Inflictor is invalid.", iIDEntity, iIDInflictor, iIDAttacker) return; } else if (pev(iIDInflictor, g_iIDEntityRocketPev) != g_iIDEntityRocket) { //ftD7Log(_, _, "[fwHamTakeDamagePlayer] iIDEntity: %d. iIDInflictor: %d. iIDAttacker: %d. Inflictor is not a rocket.", iIDEntity, iIDInflictor, iIDAttacker) return; } else if (!bitsum_get(g_iBsDeath, iIDEntity)) { //ftD7Log(_, _, "[fwHamTakeDamagePlayer] iIDEntity: %d. iIDInflictor: %d. iIDAttacker: %d. NOT a kill.", iIDEntity, iIDInflictor, iIDAttacker) return; } ftD7Log(_, _, "[fwHamTakeDamagePlayer] iIDEntity: %d. iIDInflictor: %d. iIDAttacker: %d. Health: %d. Damage: %d. KILL.", iIDEntity, iIDInflictor, iIDAttacker, get_user_health(iIDEntity), floatround(fDamage, floatround_floor)) new iTemp = get_msg_block(g_iIDMsgDeath); set_msg_block(g_iIDMsgDeath, BLOCK_ONCE) ExecuteHamB(Ham_Killed, iIDEntity, iIDAttacker, 2) set_msg_block(g_iIDMsgDeath, iTemp) ftMsgDeathSend(iIDAttacker, iIDEntity, g_szClassNameRocket, _, iIDInflictor) }*/
// Credits to VEN stock ftFMEntityOriginGet(const iIDEntity, Float:fVecTemp[3]) { new szModel[2]; pev(iIDEntity, pev_model, szModel, charsmax(szModel)) if (szModel[0] == '*') { pev(iIDEntity, pev_mins, fVecTemp) static Float:fVecTemp2[3]; pev(iIDEntity, pev_maxs, fVecTemp2); fVecTemp[0] += fVecTemp2[0]; fVecTemp[1] += fVecTemp2[1]; fVecTemp[2] += fVecTemp2[2]; fVecTemp[0] *= 0.5; fVecTemp[1] *= 0.5; fVecTemp[2] *= 0.5; return; } pev(iIDEntity, pev_origin, fVecTemp) }
ftMsgDeathSend(const iIDAttacker, const iIDVictim, const szNameWeapon[] = "", const bool:bHeadShot = false, const iIDInflictor = 0) { message_begin(MSG_ALL, g_iIDMsgDeath) write_byte(iIDAttacker) write_byte(iIDVictim) if (g_iIDMod == g_iIDModCS) { write_byte(bHeadShot) //headshot write_string(szNameWeapon) } else if (g_iIDMod == g_iIDModHL) { write_string(szNameWeapon) } else if (g_iIDMod == g_iIDModDOD) { write_byte(iIDInflictor) //weaponid } message_end() }
public fwFmTouch(iIDEntityToucher, iIDEntityTouched) { new iIDEntityRocket; if (pev_valid(iIDEntityToucher) && pev(iIDEntityToucher, g_iIDEntityRocketPev) == g_iIDEntityRocket) iIDEntityRocket = iIDEntityToucher; else if (pev_valid(iIDEntityTouched) && pev(iIDEntityTouched, g_iIDEntityRocketPev) == g_iIDEntityRocket) { iIDEntityRocket = iIDEntityTouched; iIDEntityTouched = iIDEntityToucher; iIDEntityToucher = iIDEntityRocket; } else return; new iIDEntityRocketOwner = pev(iIDEntityRocket, pev_owner); if (iIDEntityTouched == iIDEntityRocketOwner) return; new iEntityRocketOwnerTeam = get_user_team(iIDEntityRocketOwner), iIDEntityOtherOwner, Float:fCVarDamage = get_pcvar_float(CVar_RocketDmg), Float:fHealth, iTemp, Float:fDamage; static szEntityClassName[32]; // Pass through dead/same team players and team entities if (1 <= iIDEntityTouched <= g_iMaxPlayers) { if (!bitsum_get(g_iBsAlive, iIDEntityTouched) || bitsum_get(g_iBsConnected, iIDEntityTouched) && iEntityRocketOwnerTeam == get_user_team(iIDEntityTouched)) { ftD7Log(_, _, "[fwFmTouch] Touched entity is an either dead or a connected and on the same team player as the rocket owner. Ignoring.") return; } if (fCVarDamage > 0.0) { pev(iIDEntityTouched, pev_health, fHealth) set_pev(iIDEntityTouched, pev_health, 10000000.0) ExecuteHamB(Ham_TakeDamage, iIDEntityTouched, iIDEntityRocket, iIDEntityRocketOwner, fCVarDamage, DMG_BLAST) fDamage = 10000000.0 - get_user_health(iIDEntityTouched); ftD7Log(_, _, "[fwFmTouch] fHealth: %f. fDamage: %f.", fHealth, fDamage) if (fHealth > fDamage) { //if (fHealth < 1.0) //{ // ftD7Log(_, _, "[fwFmTouch] Player in explosion range has health between 0 and 1. fHealth: %f.", fHealth) //} fHealth -= fDamage; set_pev(iIDEntityTouched, pev_health, fHealth) } else { ftD7Log(_, _, "[fwFmTouch] Player hit should be dead. Executing Ham_Killed with custom death message.") //set_pev(iIDEntityTouched, pev_health, 1.0) //ExecuteHam(Ham_Spawn, iIDEntityTouched) //engfunc(EngFunc_SetOrigin, iIDEntityTouched, fVecOriginEntityInSphere) iTemp = get_msg_block(g_iIDMsgDeath); set_msg_block(g_iIDMsgDeath, BLOCK_ONCE) ExecuteHamB(Ham_Killed, iIDEntityTouched, iIDEntityRocketOwner, 2) set_msg_block(g_iIDMsgDeath, iTemp) ftMsgDeathSend(iIDEntityRocketOwner, iIDEntityTouched, g_szClassNameRocket, _, iIDEntityRocket) } } } else if (pev_valid(iIDEntityTouched)) { if (pev(iIDEntityTouched, pev_solid) <= SOLID_TRIGGER) return; iIDEntityOtherOwner = pev(iIDEntityTouched, pev_owner); if ((1 <= iIDEntityOtherOwner <= g_iMaxPlayers) && bitsum_get(g_iBsConnected, iIDEntityOtherOwner) && iEntityRocketOwnerTeam == get_user_team(iIDEntityOtherOwner)) return; if (fCVarDamage > 0.0) { pev(iIDEntityTouched, pev_health, fHealth) //ftD7Log(_, _, "[fwFmTouch] iIDEntityRocket: %d. iIDEntityTouched: %d. Damage: %f. Health: %f.", //iIDEntityRocket, iIDEntityTouched, fCVarDamage, fHealth) if (fHealth > 0.0) { pev(iIDEntityTouched, pev_takedamage, fDamage) if (fDamage != 0.0) { ExecuteHamB(Ham_TakeDamage, iIDEntityTouched, iIDEntityRocket, iIDEntityRocketOwner, fCVarDamage, DMG_BLAST) } else { pev(iIDEntityTouched, pev_classname, szEntityClassName, charsmax(szEntityClassName)) if (equali(szEntityClassName, "func_breakable")) ExecuteHamB(Ham_TakeDamage, iIDEntityTouched, iIDEntityRocket, iIDEntityRocketOwner, fCVarDamage, DMG_BLAST) } } } pev(iIDEntityTouched, pev_classname, szEntityClassName, charsmax(szEntityClassName)) ftD7Log(_, _, "[fwFmTouch] iIDEntityToucher: %d. iIDEntityTouched: %d. iIDEntityRocket: %d. Touched class name: ^"%s^".", iIDEntityToucher, iIDEntityTouched, iIDEntityRocket, szEntityClassName) } static Float:fVecOrigin[3], Float:fVecOriginEntityInSphere[3]; pev(iIDEntityRocket, pev_origin, fVecOrigin) new iIDEntityInSphere = -1, Float:fCVarRadius = get_pcvar_float(CVar_Dmg_range); //ftD7Log(_, _, "[fwFmTouch] iIDEntityRocket: %d. fVecOrigin: %f, %f, %f.", iIDEntityRocket, fVecOrigin[0], fVecOrigin[1], fVecOrigin[2]) while ((iIDEntityInSphere = engfunc(EngFunc_FindEntityInSphere, iIDEntityInSphere, fVecOrigin, fCVarRadius)) != 0) { if (iIDEntityInSphere == iIDEntityRocket || iIDEntityInSphere == iIDEntityRocketOwner || iIDEntityInSphere == iIDEntityTouched) continue; //pev(iIDEntityInSphere, pev_classname, szEntityClassName, charsmax(szEntityClassName)) //ftD7Log(_, _, "[fwFmTouch] iIDEntityInSphere: %d. Class name: ^"%s^".", iIDEntityInSphere, szEntityClassName) if (1 <= iIDEntityInSphere <= g_iMaxPlayers) { if (!bitsum_get(g_iBsAlive, iIDEntityInSphere) || iEntityRocketOwnerTeam == get_user_team(iIDEntityInSphere)) continue; pev(iIDEntityInSphere, pev_origin, fVecOriginEntityInSphere) fDamage = fCVarDamage - (fCVarDamage / fCVarRadius * get_distance_f(fVecOrigin, fVecOriginEntityInSphere)); //ftD7Log(_, _, "[fwFmTouch] iIDEntityRocket: %d. iIDEntityInSphere: %d. fVecOriginEntityInSphere: %f, %f, %f. Damage: %f.", //iIDEntityRocket, iIDEntityInSphere, fVecOriginEntityInSphere[0], fVecOriginEntityInSphere[1], fVecOriginEntityInSphere[2], fDamage) //ftD7Log(_, _, "[fwFmTouch] iIDEntityRocket: %d. iIDEntityInSphere: %d. Damage: %f.", //iIDEntityRocket, iIDEntityInSphere, fDamage) if (fDamage < 1.0) continue; /* engfunc(EngFunc_MessageBegin, MSG_ALL, SVC_TEMPENTITY, fVecOrigin, 0) write_byte(TE_LIGHTNING) engfunc(EngFunc_WriteCoord, fVecOrigin[0]) engfunc(EngFunc_WriteCoord, fVecOrigin[1]) engfunc(EngFunc_WriteCoord, fVecOrigin[2]) engfunc(EngFunc_WriteCoord, fVecOriginEntityInSphere[0]) engfunc(EngFunc_WriteCoord, fVecOriginEntityInSphere[1]) engfunc(EngFunc_WriteCoord, fVecOriginEntityInSphere[2]) write_byte(25) //life in 0.1's write_byte(25) //width in 0.1's write_byte(0) //amplitude in 0.01's write_short(g_iIDCacheSpriteRocketTrail) //sprite model index message_end()*/ pev(iIDEntityInSphere, pev_health, fHealth) set_pev(iIDEntityInSphere, pev_health, 10000000.0) ExecuteHamB(Ham_TakeDamage, iIDEntityInSphere, iIDEntityRocket, iIDEntityRocketOwner, fDamage, DMG_BLAST) fDamage = 10000000.0 - get_user_health(iIDEntityInSphere); ftD7Log(_, _, "[fwFmTouch] fHealth: %f. fDamage: %f.", fHealth, fDamage) if (fHealth > fDamage) { //if (fHealth < 1.0) //{ // ftD7Log(_, _, "[fwFmTouch] Player in explosion range has health between 0 and 1. fHealth: %f.", fHealth) //} fHealth -= fDamage; set_pev(iIDEntityInSphere, pev_health, fHealth) continue; } ftD7Log(_, _, "[fwFmTouch] Player in explosion range should be dead. Executing Ham_Killed with custom death message.") //set_pev(iIDEntityInSphere, pev_health, 1.0) //ExecuteHam(Ham_Spawn, iIDEntityInSphere) //engfunc(EngFunc_SetOrigin, iIDEntityInSphere, fVecOriginEntityInSphere) iTemp = get_msg_block(g_iIDMsgDeath); set_msg_block(g_iIDMsgDeath, BLOCK_ONCE) ExecuteHamB(Ham_Killed, iIDEntityInSphere, iIDEntityRocketOwner, 2) set_msg_block(g_iIDMsgDeath, iTemp) ftMsgDeathSend(iIDEntityRocketOwner, iIDEntityInSphere, g_szClassNameRocket, _, iIDEntityRocket) } else if (pev_valid(iIDEntityInSphere)) { pev(iIDEntityInSphere, pev_health, fHealth) if (fHealth <= 0.0) continue; iIDEntityOtherOwner = pev(iIDEntityInSphere, pev_owner); if ((1 <= iIDEntityOtherOwner <= g_iMaxPlayers) && bitsum_get(g_iBsConnected, iIDEntityOtherOwner) && iEntityRocketOwnerTeam == get_user_team(iIDEntityOtherOwner)) continue; pev(iIDEntityInSphere, pev_takedamage, fDamage) if (fDamage == 0.0) { pev(iIDEntityInSphere, pev_classname, szEntityClassName, charsmax(szEntityClassName)) if (!equali(szEntityClassName, "func_breakable")) continue; } ftFMEntityOriginGet(iIDEntityInSphere, fVecOriginEntityInSphere) //pev(iIDEntityInSphere, pev_origin, fVecOriginEntityInSphere) fDamage = fCVarDamage - (fCVarDamage / fCVarRadius * get_distance_f(fVecOrigin, fVecOriginEntityInSphere)); //ftD7Log(_, _, "[fwFmTouch] iIDEntityRocket: %d. iIDEntityInSphere: %d. fVecOriginEntityInSphere: %f, %f, %f. Damage: %f.", //iIDEntityRocket, iIDEntityInSphere, fVecOriginEntityInSphere[0], fVecOriginEntityInSphere[1], fVecOriginEntityInSphere[2], fDamage) if (fDamage <= 0.0) continue; ftD7Log(_, _, "[fwFmTouch] iIDEntityRocket: %d. iIDEntityInSphere: %d. Damage: %f. Health: %f.", iIDEntityRocket, iIDEntityInSphere, fDamage, fHealth) /* engfunc(EngFunc_MessageBegin, MSG_ALL, SVC_TEMPENTITY, fVecOrigin, 0) write_byte(TE_LIGHTNING) engfunc(EngFunc_WriteCoord, fVecOrigin[0]) engfunc(EngFunc_WriteCoord, fVecOrigin[1]) engfunc(EngFunc_WriteCoord, fVecOrigin[2]) engfunc(EngFunc_WriteCoord, fVecOriginEntityInSphere[0]) engfunc(EngFunc_WriteCoord, fVecOriginEntityInSphere[1]) engfunc(EngFunc_WriteCoord, fVecOriginEntityInSphere[2]) write_byte(25) //life in 0.1's write_byte(25) //width in 0.1's write_byte(0) //amplitude in 0.01's write_short(g_iIDCacheSpriteRocketTrail) //sprite model index message_end()*/ ExecuteHamB(Ham_TakeDamage, iIDEntityInSphere, iIDEntityRocket, iIDEntityRocketOwner, fDamage, DMG_BLAST) } } engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, fVecOrigin, 0) write_byte(TE_EXPLOSION) engfunc(EngFunc_WriteCoord, fVecOrigin[0]) engfunc(EngFunc_WriteCoord, fVecOrigin[1]) engfunc(EngFunc_WriteCoord, fVecOrigin[2]) write_short(explosion) write_byte(30) write_byte(15) write_byte(0) message_end() /* // Smallest ring engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, fVecOrigin, 0) write_byte(TE_BEAMCYLINDER) // TE id engfunc(EngFunc_WriteCoord, fVecOrigin[0]) // x engfunc(EngFunc_WriteCoord, fVecOrigin[1]) // y engfunc(EngFunc_WriteCoord, fVecOrigin[2]) // z engfunc(EngFunc_WriteCoord, fVecOrigin[0]) // x axis engfunc(EngFunc_WriteCoord, fVecOrigin[1]) // y axis engfunc(EngFunc_WriteCoord, fVecOrigin[2] + (fCVarRadius * 2) - (fCVarRadius * 2 / 3)) // z axis 385.0 write_short(white) // sprite write_byte(0) // startframe write_byte(0) // framerate write_byte(4) // life write_byte(72) // width write_byte(0) // noise write_byte(255) // red write_byte(255) // green 100 write_byte(255) // blue write_byte(200) // brightness write_byte(0) // speed message_end() // Medium ring engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, fVecOrigin, 0) write_byte(TE_BEAMCYLINDER) // TE id engfunc(EngFunc_WriteCoord, fVecOrigin[0]) // x engfunc(EngFunc_WriteCoord, fVecOrigin[1]) // y engfunc(EngFunc_WriteCoord, fVecOrigin[2]) // z engfunc(EngFunc_WriteCoord, fVecOrigin[0]) // x axis engfunc(EngFunc_WriteCoord, fVecOrigin[1]) // y axis engfunc(EngFunc_WriteCoord, fVecOrigin[2] + (fCVarRadius * 2) - (fCVarRadius * 2 / 6)) // z axis write_short(white) // sprite write_byte(0) // startframe write_byte(0) // framerate write_byte(4) // life write_byte(72) // width write_byte(0) // noise write_byte(255) // red write_byte(255) // green 100 write_byte(255) // blue write_byte(200) // brightness write_byte(0) // speed message_end() */ // Largest ring engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, fVecOrigin, 0) write_byte(TE_BEAMCYLINDER) // TE id engfunc(EngFunc_WriteCoord, fVecOrigin[0]) // x engfunc(EngFunc_WriteCoord, fVecOrigin[1]) // y engfunc(EngFunc_WriteCoord, fVecOrigin[2]) // z engfunc(EngFunc_WriteCoord, fVecOrigin[0]) // x axis engfunc(EngFunc_WriteCoord, fVecOrigin[1]) // y axis engfunc(EngFunc_WriteCoord, fVecOrigin[2] + (fCVarRadius * 2)) // z axis write_short(white) // sprite write_byte(0) // startframe write_byte(0) // framerate write_byte(4) // life write_byte(72) // width write_byte(0) // noise write_byte(255) // red write_byte(255) // green 100 write_byte(255) // blue write_byte(200) // brightness write_byte(0) // speed message_end() engfunc(EngFunc_RemoveEntity, iIDEntityRocket) }
ftFmVelocityByAim(const iID, const Float:fAmount, Float:fVecTemp[3]) { pev(iID, pev_v_angle, fVecTemp) angle_vector(fVecTemp, ANGLEVECTOR_FORWARD, fVecTemp) fVecTemp[0] *= fAmount; fVecTemp[1] *= fAmount; fVecTemp[2] *= fAmount; }
public fwFmPlayerPreThink(iID) { //ftD7Log(_, iID, "[client_PreThink] iID: %d.", iID) if (!bitsum_get(g_iBsHasBazooka, iID) || !bitsum_get(g_iBsCanShoot, iID)) { //ftD7Log(_, iID, "[client_PreThink] No bazooka/can't shoot.") return; } new iBsButtons = pev(iID, pev_button); if (!(iBsButtons & IN_ATTACK2)) { //ftD7Log(_, iID, "[client_PreThink] Not holding buttons.") return; } set_pev(iID, pev_button, (iBsButtons & ~IN_ATTACK2)) static iIDAllocString; if(!iIDAllocString) { //ftD7Log(_, iID, "[client_PreThink] String not allocated. Allocating.") iIDAllocString = engfunc(EngFunc_AllocString, "info_target"); // alloc string once per load } new iIDEntity = engfunc(EngFunc_CreateNamedEntity, iIDAllocString); if (!pev_valid(iIDEntity)) { //ftD7Log(_, iID, "[client_PreThink] Entity failed to create!") return; } set_pev(iIDEntity, pev_classname, g_szClassNameRocket) set_pev(iIDEntity, g_iIDEntityRocketPev, g_iIDEntityRocket) set_pev(iIDEntity, pev_owner, iID) static Float:fVecTemp[3]; pev(iID, pev_v_angle, fVecTemp) fVecTemp[0] *= -1; set_pev(iIDEntity, pev_angles, fVecTemp) set_pev(iIDEntity, pev_solid, SOLID_TRIGGER) set_pev(iIDEntity, pev_movetype, MOVETYPE_FLY) new Float:fEntMaxVelocity = get_pcvar_float(g_iIDPCVarSvMaxVelocity); ftFmVelocityByAim(iID, floatclamp(get_pcvar_float(CVar_RocketSpeed), -fEntMaxVelocity, fEntMaxVelocity), fVecTemp) set_pev(iIDEntity, pev_velocity, fVecTemp) set_pev(iIDEntity, pev_effects, (pev(iIDEntity, pev_effects) | EF_LIGHT)) static Float:fVecTemp2[3]; pev(iID, pev_origin, fVecTemp) pev(iID, pev_view_ofs, fVecTemp2) fVecTemp[0] += fVecTemp2[0]; fVecTemp[1] += fVecTemp2[1]; fVecTemp[2] += fVecTemp2[2]; engfunc(EngFunc_SetOrigin, iIDEntity, fVecTemp) engfunc(EngFunc_SetModel, iIDEntity, g_szEntityRocketModel) message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(TE_BEAMFOLLOW); write_short(iIDEntity); write_short(g_iIDCacheSpriteRocketTrail); write_byte(11); write_byte(5); write_byte(191); write_byte(191); write_byte(191); write_byte(random_num(150, 240)); message_end(); emit_sound(iIDEntity, CHAN_WEAPON, ROCKET_SOUND, 1.0, ATTN_NORM, 0, PITCH_NORM) bitsum_del(g_iBsCanShoot, iID) set_task(get_pcvar_float(CVar_RocketDelay), "fwTaskCanShoot", iID) }
public fwTaskCanShoot(const iID) { bitsum_add(g_iBsCanShoot, iID) client_print(iID, print_center, "Your can now shoot the next rocket!") }
__________________
|
|