Raised This Month: $ Target: $400
 0% 

First Person View on another player help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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:09.


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