AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Cycling through player views (https://forums.alliedmods.net/showthread.php?t=48207)

Python 12-07-2006 09:20

Cycling through player views
 
I want to cycle through the players and see what they see, when Im in spectating mode. I know Im able to do this by pressing mouse1/mouse2, but I want to automatically do this @ respawn. It has to stop at a player which I choose in a menu, so I will see what he's seeing.

So basicly it has to do this:

1) Choose player from menu (piece of cake..)
2) Respawn: cycle through players (check..)
3) Stop @ choosen player (too easy..)
4) Let me see what choosen player is seeing and stick with him / spectate him (many attempts failed...)

I tried to do it with get_user_origin and setting this origin for the specator but this doesn't seem to work.

dutchmeat 12-07-2006 10:17

Re: Cycling through player views
 
You can use attach_view, "attach_view ( player, target ) "
The target can't be a player, so you will have to create an entity that follows the player you wish to spectate.
This is a my Proof of concept, and has not yet been tested, so try this out.

Code:
new camera[33] public FollowPlayer(id,id2){ new Float:origin[3]; entity_get_vector(id2,EV_VEC_origin,origin) ; new camera[id] = create_entity("info_target"); entity_set_string(camera[id],EV_SZ_classname,"spectatorcamera") ; entity_set_origin(camera[id],origin); entity_set_int(camera[id], EV_INT_movetype, MOVETYPE_FOLLOW ); //follow the player entity_set_edict(camera[id], EV_ent_aiment, id );  //set aim entity_set_edict(camera[id], EV_ent_owner,33); } Public Follow(id){ attach_view ( id, camera[id] ) }

dutchmeat 12-07-2006 10:23

Re: Cycling through player views
 
excuse me:

Code:

Public Follow(id){
//you will have to find out yourself which player you want to follow(menu?) that should be id2
FollowPlayer(id,id2)

if (camera[id]){

attach_view ( id, camera[id] )
}else{
console_print(id,"I could NOT attach you to the player")
}
}


Python 12-07-2006 10:31

Re: Cycling through player views
 
Ok thnx!

Btw what includes do I need?

watch 12-07-2006 10:31

Re: Cycling through player views
 
Why do you use semicolon, whitespace and case inconsistantly ;)?

You would also have to do a bit more than set the origin, angles etc :>

dutchmeat 12-07-2006 10:36

Re: Cycling through player views
 
well i'll test it when i get home then :)

Python 12-07-2006 10:38

Re: Cycling through player views
 
Watch do you know a piece of code that will work and has been tested?


All times are GMT -4. The time now is 06:57.

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