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 10-09-2014 , 16:08   Re: How to rewrite "spectator mode" to not be able to change players?
Reply With Quote #1

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