Raised This Month: $ Target: $400
 0% 

First Person View on another player help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
-hi-
Member
Join Date: Jul 2006
Old 10-02-2007 , 00:48   First Person View on another player help
Reply With Quote #1

Hey all,

I'm writing a plugin that will allow a player to spectate another player in first-person view without joining the spectators team. The following code does exactly what I want except for one thing: the model of the player is still visible when I'm spectating them. Is there a way to make it so the camera entity does not see the model of the player it is following? (The camera is right at the spectatee's eye level so I'm always seeing the back of their neck basically.)

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #define PLUGIN "Eye Spectating" #define VERSION "1.0" #define AUTHOR "hi" #pragma semicolon 1 new g_cameras[33];          // g_cameras[id] contains index of camera above the spectatEE new g_eyeingWho[33];        // g_eyeingWho[id] will contain player id of the spectatEE (id is of spectatOR) new Float:g_fPos[33][3];    // float origins of users new Float:g_fAngles[33][3]; // float angles of users (where they're looking) public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);     register_clcmd("say", "hookSay", 0, "");     register_clcmd("say angles", "angles", 0, "");     register_clcmd("say origins", "origins", 0, ""); } public plugin_precache() {     precache_model("models/bomblet.mdl"); } public origins(id, level, cid) {     new origin1[3], origin2[3];     get_user_origin(id, origin1);     get_user_origin(id, origin2, 1);     client_print(id, print_chat, "%d %d %d", origin1[0], origin1[1], origin1[2]);     client_print(id, print_chat, "%d %d %d", origin2[0], origin2[1], origin2[2]); } public angles(id, level, cid) {     new Float:angles[3];     entity_get_vector(id, EV_VEC_angles, angles);     client_print(id, print_chat, "user angles: %d %d %d", floatround(angles[0]), floatround(angles[1]), floatround(angles[2])); } public hookSay(id, level, cid) {     new args[256];     read_args(args, 255);     remove_quotes(args);     if (equali(args, "/eye", 4)) {         if (containi(args, "off") != -1) {             if (g_eyeingWho[id]) {                 g_eyeingWho[id] = 0;                 // todo: finish this             } else {                 client_print(id, print_chat, "You weren't eyeing anyone!");             }             return PLUGIN_HANDLED;         }         new name[128];         parse(args[4], name, 127);         new target = cmd_target(id, name, 6);         if (target) {             new cam;             cam = create_entity("info_target");             entity_set_model(cam, "models/bomblet.mdl");             entity_set_edict(cam, EV_ENT_pContainingEntity, target);             g_cameras[target] = cam;             attach_view(id, cam);         } else {             client_print(id, print_chat, "ERROR: can't find player %s (be more specific, use quotes to enclose spaces)", name);         }         return PLUGIN_HANDLED;     }     return PLUGIN_CONTINUE; } public client_PreThink(id) {     if (g_cameras[id]) {         entity_get_vector(id, EV_VEC_origin, g_fPos[id]);         entity_get_vector(id, EV_VEC_angles, g_fAngles[id]);         g_fPos[id][2] += 28.0// moves camera to eye level         g_fAngles[id][0] *= -3.0; // makes the angle come out right         entity_set_origin(g_cameras[id], g_fPos[id]);         entity_set_vector(g_cameras[id], EV_VEC_angles, g_fAngles[id]);     } }
-hi- is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 10-02-2007 , 03:32   Re: First Person View on another player help
Reply With Quote #2

Set its aiment to the client it's following. That should prevent you from seeing him.

If pev_aiment doesn't do it, do it in EntityState
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
-hi-
Member
Join Date: Jul 2006
Old 10-02-2007 , 15:39   Re: First Person View on another player help
Reply With Quote #3

I used the following to set the aiment, but I can still see the model of the player I'm following:

Code:
if (target) {
  new cam;             
  cam = create_entity("info_target");
  entity_set_model(cam, "models/bomblet.mdl");
  entity_set_edict(cam, EV_ENT_aiment, target);
  g_cameras[target] = cam;
  attach_view(id, cam);
}
See the attached screenshot for what this looks like.

I used EntityState in the following manner and it crashes the game:

Code:
if (target) {             
    new cam;             
    cam = create_entity("info_target");             
    entity_set_model(cam, "models/bomblet.mdl");             
    //entity_set_edict(cam, EV_ENT_aiment, target);             
    set_es(cam, ES_AimEnt, target);             
    g_cameras[target] = cam;             
    attach_view(id, cam);         
}
Attached Thumbnails
Click image for larger version

Name:	2fort0000.JPG
Views:	209
Size:	22.4 KB
ID:	20595  

Last edited by -hi-; 10-02-2007 at 16:22.
-hi- is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 10-02-2007 , 20:17   Re: First Person View on another player help
Reply With Quote #4

That's not how you do it with entity state.

Code:
new target; public plugin_init() {    register_forward( FM_UpdateClientData, "hook_UpdateClientData_post", 1 ); } public hook_AddToFullPack_post( es_handle, e, entid, host, hostflags, player, pSet ) {    if( player && target )    {       set_es( entid, ES_AimEnt, target );    } }

Hopefully that gives you the idea.
Make sure you include fakemeta.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
-hi-
Member
Join Date: Jul 2006
Old 10-03-2007 , 17:20   Re: First Person View on another player help
Reply With Quote #5

I played around with this a lot, and the model is still visible. Is there a property that the "player" entity has that makes it so it doesn't see's it's own model?
-hi- is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 10-04-2007 , 03:43   Re: First Person View on another player help
Reply With Quote #6

No there isn't a property. I wish there was. I was trying to achieve almost the exact opposite a while back, here: http://forums.alliedmods.net/showthread.php?t=52441
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
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 23:03.


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