Raised This Month: $51 Target: $400
 12% 

[REQ] Tournament Camera!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GoldNux
Senior Member
Join Date: Mar 2018
Old 04-06-2018 , 10:23   [REQ] Tournament Camera!
Reply With Quote #1

I will be hosting a tournament in a few weeks, and every match will be streamed live on Twitch.
Me and a friend will comment on the gameplay, and I will control what you will see on the stream.

Spectating in 1.6 is quite flawed, and it is not so easy to switch between players and make it look good.
But I have used spec_mode and bound the different modes to keys so I can switch using those.

The request:

I would like to be able to place cameras and switch to them by using buttons.
For example: I take the coordinates and angle of bomb site on A and save them in the plugin.
That way I can quickly jump to different positions and get some nice shots.

I chopped up a plugin called Spectator Camera to try and do this.
And I am able to switch to the camera, but the coordinates I placed are not correct and there is no angle to the camera.

The slimmed code looks like this:

PHP Code:
#include <amxmodx>
#include <fakemeta>

new MODEL[] = "models/player/vip/vip.mdl";

new 
giCameraEntity;
new 
bool:gbCameraActive[33];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_clcmd("+camera",     "CameraActivate");
    
CameraInit();
}

public 
plugin_precache()
    
precache_model(MODEL);

public 
CameraInit() {
    
giCameraEntity engfunc(EngFunc_CreateNamedEntityengfunc(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.0180.00.0});            // Test using angles
    
CameraSetOrigin(Float:{438.2510142.30312.30});                                    // Place Camera in the middle of the map
}

public 
CameraSetOrigin(Float:fOrigin[3]) {
    new 
Float:fMins[3], Float:fMaxs[3];
    
pev(giCameraEntitypev_minsfMins);
    
pev(giCameraEntitypev_maxsfMaxs);
    
engfunc(EngFunc_SetSizegiCameraEntityfMinsfMaxs);

    return 
engfunc(EngFunc_SetOrigingiCameraEntityfOrigin);
}

public 
CameraActivate(iPlayerId) {
    
engfunc(EngFunc_SetViewiPlayerIdgiCameraEntity);
    
gbCameraActive[iPlayerId] = true;
    
client_print(iPlayerIdprint_chat"[Camera] Has just been enabled.");
}

// Thanks to GHW_Chronic for this stock

stock entity_set_aim(ent,const Float:origin2[3],bone=0)
{
    if(!
pev_valid(ent))
        return 
0;

    static 
Float:origin[3]
    
origin[0] = origin2[0]
    
origin[1] = origin2[1]
    
origin[2] = origin2[2]

    static 
Float:ent_origin[3], Float:angles[3]

    if(
bone)
        
engfunc(EngFunc_GetBonePosition,ent,bone,ent_origin,angles)
    else
        
pev(ent,pev_origin,ent_origin)

    
origin[0] -= ent_origin[0]
    
origin[1] -= ent_origin[1]
    
origin[2] -= ent_origin[2]

    static 
Float:v_length
    v_length 
vector_length(origin)

    static 
Float:aim_vector[3]
    
aim_vector[0] = origin[0] / v_length
    aim_vector
[1] = origin[1] / v_length
    aim_vector
[2] = origin[2] / v_length

    
static Float:new_angles[3]
    
vector_to_angle(aim_vector,new_angles)

    
new_angles[0] *= -1

    
if(new_angles[1]>180.0new_angles[1] -= 360
    
if(new_angles[1]<-180.0new_angles[1] += 360
    
if(new_angles[1]==180.0 || new_angles[1]==-180.0new_angles[1]=-179.999999

    set_pev
(ent,pev_angles,new_angles)
    
set_pev(ent,pev_fixangle,1)

    return 
1;

If someone could give this a shot it would make me real happy.
Thanks a ton!
__________________
Try my version of de_dust2, I think it's great and you should check it out!
https://gamebanana.com/mods/83731

Last edited by GoldNux; 04-06-2018 at 10:29.
GoldNux is offline
Visinescu
Senior Member
Join Date: Dec 2015
Location: England now,Home Romania
Old 04-08-2018 , 09:48   Re: [REQ] Tournament Camera!
Reply With Quote #2

This a russian plugin I've found online, i don't know russian but here is the description and picture.
Spoiler
Attached Files
File Type: sma Get Plugin or Get Source (camera.sma - 743 views - 6.3 KB)
File Type: zip models.zip (361.2 KB, 243 views)
Visinescu is offline
GoldNux
Senior Member
Join Date: Mar 2018
Old 04-09-2018 , 10:07   Re: [REQ] Tournament Camera!
Reply With Quote #3

Quote:
Originally Posted by Visinescu View Post
This a russian plugin I've found online, i don't know russian but here is the description and picture.
Spoiler
Thank you!

I will have to check this out as it is very relevant.
Still need some help taking it appart tho.
__________________
Try my version of de_dust2, I think it's great and you should check it out!
https://gamebanana.com/mods/83731

Last edited by GoldNux; 04-09-2018 at 10:07.
GoldNux is offline
thEsp
BANNED
Join Date: Aug 2017
Old 10-07-2018 , 07:23   Re: [REQ] Tournament Camera!
Reply With Quote #4

I don't know if it is possible in pawn, but in VHE (Valve hammer editor - HL mapping tool) you can add cameras.
For example de_dust2 has camera points. Nice idea tho.
thEsp is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:04.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode