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

Solved Set player view to specified trigger_camera ent?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 06-09-2021 , 18:45   Set player view to specified trigger_camera ent?
Reply With Quote #1

I've made a custom map and included a single trigger_camera entity with the targetname set to "KEYCAM" and don't want to set it off through the usual way by triggering it (not that it matters, since it's multiplayer cs 1.6), but would rather use the engine function and set the player's view to it instead.
When I trigger the engine function, the player's view gets to the center of the map (0, 0, 0) instead of the camera that is placed elsewhere. How do I resolve this issue? Note that I want it to be done programmatically and not through mapping.

PHP Code:
new g_ent;

public 
plugin_init() {

    
register_clcmd("say /cam""CmdCam");

    new 
ent = -1tname[32];
    while (
ent find_ent_by_class(ent"trigger_camera")) {

        
pev(entpev_targetnametnamecharsmax(tname));
        if (
equal(tname"KEYCAM")) {

            
g_ent ent;
            
log_amx("Cam found: %d"ent);
            break;
        }
    }
}

public 
CmdCam(id) {

    
engfunc(EngFunc_SetViewidg_ent);


Last edited by redivcram; 06-10-2021 at 18:09.
redivcram is offline
 



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 05:17.


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