Raised This Month: $ Target: $400
 0% 

How to rewrite "spectator mode" to not be able to change players?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Drago36
Junior Member
Join Date: Jul 2014
Old 07-12-2014 , 11:07   How to rewrite "spectator mode" to not be able to change players?
Reply With Quote #1

Hey.

I have this code:
Code:
public WejdzWCialo(id)
{
    fm_set_rendering(id,kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 100) // A - changing visibility Player
    
    new iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")) // B - create a ent
    set_pev(iEnt, pev_classname, "player_hat") // B
    engfunc(EngFunc_SetModel, iEnt, "models/cod_jasnowidz.mdl") // B
    
    set_pev(iEnt, pev_movetype, MOVETYPE_FOLLOW) // C - created the ent follows the victim of wybrany[id]
    set_pev(iEnt, pev_aiment, wybrany[id]) // C
    set_pev(iEnt, pev_owner, wybrany[id]) // C
    
    new info[2] // D - data transfer set_task
    info[0] = id // D
    info[1] = wybrany[id] // D
    
    engfunc(EngFunc_SetView, id, iEnt) // C - code on the so-called "spectator mode"
    set_pev(id,pev_sequence,107)
    set_pev(id,pev_gaitsequence,6)
    set_pev(id,pev_iuser1,2)
    set_pev(id,pev_iuser2,wybrany[id])
    set_pev(id,pev_frame,255.0)
    set_pev(id,pev_framerate,1.0) // end C
    
    set_task(SLEDZ.0, "KoniecPodgladu",.parameter=info, .len=2) // D
}

public KoniecPodgladu(info[2])
{
    new id = info[0] // D
    new sledzony = info[1] // D
    
    engfunc(EngFunc_SetView, id, id) // E - ent transition from model
    set_pev(id,pev_sequence,75) // C - remove the "spectator mode"
    set_pev(id,pev_gaitsequence,1)
    set_pev(id,pev_iuser1,0)
    set_pev(id,pev_iuser2,0)
    set_pev(id,pev_frame,float(random(35)+110))
    set_pev(id,pev_framerate,1.0) // end C
    
    new iEnt = fm_find_ent_by_owner(-1, "player_hat", sledzony) // F - detection ent
    engfunc(EngFunc_RemoveEntity, iEnt) // F - delete ent
    
    fm_set_rendering(id,kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 255) // getting rid of invisibility 
}
This causes the player enters the ent created on another player.
All around him he sees as a spectator (See below).
Spoiler

After clicking the "DUCK" opens a window on the bottom and the player can afford to change the view of the other player. I would like to block, or otherwise adjust the camera.

Maybe somehow through "pev_body"? I would ask for the sample code.
Thank you for your answers.

Last edited by Drago36; 07-13-2014 at 02:28. Reason: Adding small details
Drago36 is offline
Drago36
Junior Member
Join Date: Jul 2014
Old 07-13-2014 , 13:37   Re: How to rewrite "spectator mode" to not be able to change players?
Reply With Quote #2

Maybe you know how to replace the code that the view was over the player, but without the "spectator mode"? P.S Sorry for understatement, I am using google translate
Code:
    set_pev(id,pev_sequence,107)
    set_pev(id,pev_gaitsequence,6)
    set_pev(id,pev_iuser1,2)
    set_pev(id,pev_iuser2,wybrany[id])
    set_pev(id,pev_frame,255.0)
    set_pev(id,pev_framerate,1.0

Last edited by Drago36; 07-13-2014 at 13:38.
Drago36 is offline
Drago36
Junior Member
Join Date: Jul 2014
Old 07-21-2014 , 10:53   Re: How to rewrite "spectator mode" to not be able to change players?
Reply With Quote #3

@ref
Drago36 is offline
Drago36
Junior Member
Join Date: Jul 2014
Old 08-16-2014 , 08:51   Re: How to rewrite "spectator mode" to not be able to change players?
Reply With Quote #4

@ref
Drago36 is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 08-16-2014 , 15:09   Re: How to rewrite "spectator mode" to not be able to change players?
Reply With Quote #5

AFAIK, either pev_iuser1 or pev_iuser2 control the "spector mode". Try to play with other values like pev_iuser3, pev_iuser4, pev_euser, pev_fuser
RateX is offline
Drago36
Junior Member
Join Date: Jul 2014
Old 09-23-2014 , 11:57   Re: How to rewrite "spectator mode" to not be able to change players?
Reply With Quote #6

@ref
Drago36 is offline
Old 09-27-2014, 15:45
Drago36
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
Drago36
Junior Member
Join Date: Jul 2014
Old 10-09-2014 , 16:08   Re: How to rewrite "spectator mode" to not be able to change players?
Reply With Quote #8

I worked it out in such a way:
Code:
public WejdzWCialo(id)
{
	get_user_name(wybrany[id], name, 32)
	ColorChat(id, GREEN, "Obserwujesz: ^x01%s!", name)
	fm_set_rendering(id,kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 25)
	
	new iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
	set_pev(iEnt, pev_classname, "player_hat")
	engfunc(EngFunc_SetModel, iEnt, "models/w_c4.mdl")
	set_pev(iEnt, pev_solid, SOLID_TRIGGER)
	set_pev(iEnt, pev_movetype, MOVETYPE_FLYMISSILE)
	set_pev(iEnt, pev_owner, wybrany[id])
	set_pev(iEnt, pev_rendermode, kRenderTransTexture)
	set_pev(iEnt, pev_renderamt, 0.0)
	engfunc(EngFunc_SetView, id, iEnt)
	set_pev(iEnt, pev_nextthink, get_gametime())
	
	message_begin(MSG_ONE, msg_bartime, _, id)
	write_short(SLEDZ)
	message_end()
	
	new info[3]
	info[0] = id
	info[1] = wybrany[id]
	info[2] = iEnt
	
	if(get_cvar_num("cod_jasnowidz_odglos") == 1)
		//emit_sound(wybrany[id], CHAN_VOICE, "cod_jasnowidz/wchodzi.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) // odglos wokol ofiary (sledzonego)
	set_task(SLEDZ.0, "KoniecPodgladu",.parameter=info, .len=3)
}

public KoniecPodgladu(info[3])
{
	new id = info[0]
	new sledzony = info[1]
	new iEnt = info[2]
	
	engfunc(EngFunc_SetView, id, id)
	engfunc(EngFunc_RemoveEntity, iEnt)
	fm_set_rendering(id,kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 255)
	
	if(get_cvar_num("cod_jasnowidz_radar") != 1) return
	if(!is_user_alive(sledzony)) return
	if(!is_user_alive(id))
	{
		ColorChat(id, RED, "Niestety nie dozyles. Nie udostepnisz namiarow na wroga swojej ^x03 druzynie.")
		return
	}
	oznaczony[sledzony] = true
	
	#if RADAR == 0
	
	ColorChat(id, RED, "Ofiara jest oznaczona na radarze!")
	
	#else
	
	ColorChat(id, RED, "Ofiara jest oznaczona przez %d sekund na radarze!", RADAR)
	set_task(RADAR.0-6.0, "SledzOfiare", sledzony+541230)
	
	#endif
}

public FM_KameraGracza(iEnt)
{
	static szClassname[32]
	pev(iEnt, pev_classname, szClassname, sizeof szClassname - 1)
	
	if(!equal(szClassname, "player_hat"))
		return FMRES_IGNORED
	
	static iOwner
	iOwner = pev(iEnt, pev_owner)
	
	if(!is_user_alive(iOwner))
		return FMRES_IGNORED
	
	static Float:fOrigin[3], Float:fAngle[3]
	pev(iOwner, pev_origin, fOrigin)
	pev(iOwner, pev_v_angle, fAngle)
	static Float:fVBack[3]
	angle_vector(fAngle, ANGLEVECTOR_FORWARD, fVBack)
	//odleglosc kamery od postaci
	fOrigin[2] += 20.0
	fOrigin[0] += (-fVBack[0] * 150.0)
	fOrigin[1] += (-fVBack[1] * 150.0)
	fOrigin[2] += (-fVBack[2] * 150.0)
	
	engfunc(EngFunc_SetOrigin, iEnt, fOrigin)
	set_pev(iEnt, pev_angles, fAngle)
	set_pev(iEnt, pev_nextthink, get_gametime())
	
	return FMRES_HANDLED;
}
Drago36 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 21:10.


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