Quote:
Originally Posted by iggy_bus
http://djeyl.net/forum/index.php?sho...=forcechasecam
Since it is from amx mod you will have to use amx mode x 1.76a because it has reverse compatibility plugin.
I had this plugin bt it bugs, very offten happens that even regular players can see all players, not just admins, so I removed it
|
Code:
/*******************************************************************************************************
AMX Forcechasecam
Author: KRoTaL
Version: 0.2
0.1 Release
0.2 Selects the next friend automatically
Players without immunity (you can modify the admin flag in the code, search for ADMIN_IMMUNITY)
cannot spectate the other team (and they can't use freeview, ...).
If they select an enemy, the plugin will automatically make them watch their next friend
by executing +attack on them.
Admins can spectate both teams.
Set mp_forcechasecam to 0.
Cvars:
amx_forcechasecam 1 - 0: disables the plugin
1: enables the plugin
amx_forceftb 1 - 0: does not fade to black if watching an enemy
1: fades to black if watching an enemy
This cvar is taken into account only if amx_forcechasecam is set to 1.
*******************************************************************************************************/
#include <amxmodx>
#include <amxmisc>
#include <engine>
new maxplayers
new gMsgScreenFade
public plugin_init()
{
register_plugin("Forcechasecam", "0.2", "KRoTaL")
register_cvar("amx_forcechasecam", "1")
register_cvar("amx_forceftb", "1")
set_task(0.1, "check_spectated", 45421000, "", 0, "b")
gMsgScreenFade = get_user_msgid("ScreenFade")
maxplayers = get_maxplayers()
}
public check_spectated()
{
if(get_cvar_num("amx_forcechasecam") == 0)
{
return PLUGIN_CONTINUE
}
for(new id = 1 ; id <= maxplayers ; id++)
{
if(is_user_connected(id))
{
if(!(get_user_flags(id) & ADMIN_IMMUNITY))
{
new team = get_user_team(id)
if(!is_user_alive(id) && (team == 1 || team == 2) && entity_get_int(id, EV_INT_deadflag) == 2)
{
if(entity_get_int(id, EV_INT_iuser1) != 4)
{
entity_set_int(id, EV_INT_iuser1, 4)
}
new spectated = entity_get_int(id, EV_INT_iuser2)
if(get_user_team(spectated) != team)
{
client_cmd(id, "+attack;wait;-attack")
if(get_cvar_num("amx_forceftb") == 1)
{
message_begin(MSG_ONE, gMsgScreenFade, {0,0,0}, id)
write_short(1<<12)
write_short(1<<12)
write_short(1<<12)
write_byte(0)
write_byte(0)
write_byte(0)
write_byte(255)
message_end()
}
}
else
{
if(get_cvar_num("amx_forceftb") == 1)
{
message_begin(MSG_ONE, gMsgScreenFade, {0,0,0}, id)
write_short(1)
write_short(1)
write_short(12)
write_byte(0)
write_byte(0)
write_byte(0)
write_byte(0)
message_end()
}
}
}
}
}
}
return PLUGIN_CONTINUE
}
Looked alright when I was going through it. Should 'eventually' get to a friend instead of an enemy because the cryptic way of "+attack;wait;-attack" may not be 100% foolproof :-).
Converted to AMXX.
Slmclarengt
__________________