Senior Member
|
01-04-2019
, 20:15
Re: BOMB Effects Camera
|
#7
|
Quote:
Originally Posted by sekac
Here is this test plugin, I know it works if you plant the bomb and die with no teammates left alive and there is at least 1 ct left alive. You must be in first person camera too. Hopefully it helps someone.
Edited this plugin: Link
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
new PLUGIN[] = "Spectator Camera";
new VERSION[] = "0.1 Beta";
new AUTHOR[] = "Multiply";
new MODEL[] = "models/player/vip/vip.mdl";
new bool:bombPlanted;
new giCameraEntity;
new bool:gbCameraActive[33];
new bool:specEnabledT;
new bool:specEnabledCT;
new const g_szBombModel[] = "models/w_c4.mdl"
new Float:g_fBombOrigin[3]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
register_clcmd("camera", "CameraToggle");
register_clcmd("+camera", "CameraActivate");
register_clcmd("-camera", "CameraDeactivate");
register_forward(FM_StartFrame, "fwdServerFrame");
register_logevent("logevent_PlantedTheBomb", 3, "2=Planted_The_Bomb")
register_event("DeathMsg", "EventDeath", "a")
CameraInit();
}
public plugin_precache()
precache_model(MODEL);
public juhp_eventPlayerSpawn(iPlayerId) {
CameraDeactivate(iPlayerId);
}
public client_disconnect(iPlayerId) {
CameraDeactivate(iPlayerId);
countAlivePlayers(iPlayerId);
}
public CameraInit() {
giCameraEntity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); // Create Camera Entity
set_pev(giCameraEntity, pev_classname, "Multiply_Camera"); // Give the Camera a name
set_pev(giCameraEntity, pev_solid, SOLID_NOT); // Make the Camera semiclip
engfunc(EngFunc_SetModel, giCameraEntity, MODEL); // Set Camera Model (Needed, for EngFunc_SetView to work properly)
set_pev(giCameraEntity, pev_movetype, MOVETYPE_FLY); // Stop the Camera from dropping on the ground
set_pev(giCameraEntity, pev_health, 1.0); // Set Camera health to 1
set_pev(giCameraEntity, pev_takedamage, 0.0); // Make Camera invincible
set_pev(giCameraEntity, pev_rendermode, 5); // Fix rendermode
set_pev(giCameraEntity, pev_renderamt, 0.0); // Make it less visable
set_pev(giCameraEntity, pev_angles, Float:{0.0, 180.0, 0.0}); // Test using angles
CameraSetOrigin(Float:{0.0, 0.0, 0.0}); // Place Camera in the middle of the map
}
public CameraSetOrigin(Float:fOrigin[3]) {
new Float:fMins[3], Float:fMaxs[3];
pev(giCameraEntity, pev_mins, fMins);
pev(giCameraEntity, pev_maxs, fMaxs);
engfunc(EngFunc_SetSize, giCameraEntity, fMins, fMaxs);
return engfunc(EngFunc_SetOrigin, giCameraEntity, fOrigin);
}
public CameraToggle(iPlayerId) {
switch (gbCameraActive[iPlayerId]) {
case true: CameraDeactivate(iPlayerId);
case false: CameraActivate(iPlayerId);
}
return PLUGIN_HANDLED;
}
public CameraActivate(iPlayerId) {
if (!is_user_alive(iPlayerId)) {
engfunc(EngFunc_SetView, iPlayerId, giCameraEntity);
gbCameraActive[iPlayerId] = true;
}
return PLUGIN_HANDLED;
}
public CameraDeactivate(iPlayerId) {
engfunc(EngFunc_SetView, iPlayerId, iPlayerId);
gbCameraActive[iPlayerId] = false;
return PLUGIN_HANDLED;
}
public logevent_PlantedTheBomb()
{
new iC4 = -1
if((iC4 = find_ent_by_model(iC4, "grenade", g_szBombModel)))
{
pev(iC4, pev_origin, g_fBombOrigin)
CameraSetOrigin(g_fBombOrigin)
bombPlanted = true
}
}
public countAlivePlayers(id) {
if(!bombPlanted) return
new iPlayers[32], iTAlive, iCTAlive;
get_players(iPlayers, iTAlive, "ae", "TERRORIST");
get_players(iPlayers, iCTAlive, "ae", "CT");
specEnabledT = !clamp(iTAlive, 0, 1)
specEnabledCT = !clamp(iCTAlive, 0, 1)
for(new i = 0; i < 32; i++)
if(get_user_team(i) == 1 && specEnabledT || get_user_team(i) == 2 && specEnabledCT)
set_task(5.0, "CameraActivate", i)
}
public EventDeath() {
new id = read_data(2)
countAlivePlayers(id)
}
|
it would be much better if it were in free look and not in first person, there is some way to change it
__________________
|
|