/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
#include <cstrike>
#include <fakemeta>
#define PLUGIN "Spectator Maskepp"
#define VERSION "2.0"
#define AUTHOR "RsN"
#define JOG ADMIN_KICK
new prefix[] = "AMXX"
new error[] = "AMXX Error"
new spectator[33];
new bool:duppla_ugras[33];
new g_onoff;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_forward(FM_CmdStart, "duplaugras");
register_clcmd("say /spec","spec")
register_clcmd("say_team /spec","spec")
register_concmd("amx_spec","givespec",JOG,"<nev> <1|0> - Jatekos szerepeben spectator")
g_onoff = register_cvar("amx_spectator","1")
}
public spec(id)
{
if(get_pcvar_num(g_onoff) == 1)
{
new team = get_user_team(id)
if(get_user_flags(id) & ADMIN_KICK)
{
if(is_user_alive(id))
{
if(team && CS_TEAM_SPECTATOR)
{
if(spectator[id] == 1)
{
cs_set_user_team(id, CS_TEAM_SPECTATOR)
set_user_godmode(id,1)
set_entity_visibility(id, 0);
strip_user_weapons(id)
set_user_footsteps(id, 0)
set_hudmessage(255, 0, 255, 0.0, 0.62, 0, 6.0, 12.0)
show_hudmessage(id, "[%s]: Mostantol nezo vagy!",prefix)
spectator[id] = 0;
}
else if(spectator[id] == 0)
{
set_hudmessage(255, 0, 255, 0.0, 0.62, 0, 6.0, 12.0)
show_hudmessage(id, "[%s]: Mostantol nem vagy jatekban!",prefix)
set_entity_visibility(id, 1);
set_user_godmode(id, 0)
cs_set_user_team(id, CS_TEAM_UNASSIGNED)
user_kill(id)
set_user_frags(id, 0)
set_user_footsteps(id, 1)
cs_set_user_deaths(id,0)
spectator[id] = 1;
}
}
else
{
set_hudmessage(255, 0, 0, -1.0, -1.0)
show_hudmessage(id, "[%s]: Mar spectator vagy!",error)
}
}
}
else
{
set_hudmessage(255, 0, 0, -1.0, -1.0)
show_hudmessage(id, "[%s]: Nem vagy admin!",error)
}
}
}
public client_putinserver(id) spectator[id] = 1;
public client_PreThink(id) {
if(get_pcvar_num(g_onoff) == 1)
{
if(cs_get_user_team(id) != CS_TEAM_SPECTATOR)
return PLUGIN_CONTINUE;
entity_set_float(id, EV_FL_fuser2, 0.0)
if (entity_get_int(id, EV_INT_button) & 2) {
new flags = entity_get_int(id, EV_INT_flags)
if (flags & FL_WATERJUMP)
return PLUGIN_CONTINUE
if ( entity_get_int(id, EV_INT_waterlevel) >= 2 )
return PLUGIN_CONTINUE
if ( !(flags & FL_ONGROUND) )
return PLUGIN_CONTINUE
new Float:velocity[3]
entity_get_vector(id, EV_VEC_velocity, velocity)
velocity[2] += 250.0
entity_set_vector(id, EV_VEC_velocity, velocity)
entity_set_int(id, EV_INT_gaitsequence, 6)
}
}
return PLUGIN_CONTINUE
}
public duplaugras(id, uc_handle)
{
if(get_pcvar_num(g_onoff) == 1)
{
if(cs_get_user_team(id) != CS_TEAM_SPECTATOR)
return FMRES_IGNORED;
new button = get_uc(uc_handle, UC_Buttons);
new oldbutton = pev(id, pev_oldbuttons);
new flags = pev(id, pev_flags);
if((button & IN_JUMP) && !(flags & FL_ONGROUND) && !(oldbutton & IN_JUMP) && duppla_ugras[id])
{
duppla_ugras[id] = false;
new Float:velocity[3];
pev(id, pev_velocity, velocity);
velocity[2] = random_float(265.0,285.0);
set_pev(id, pev_velocity, velocity);
}
else if(flags & FL_ONGROUND)
duppla_ugras[id] = true;
}
return FMRES_IGNORED;
}
public givespec(id,level,cid) {
if(get_pcvar_num(g_onoff) == 1)
{
if(!cmd_access(id,level,cid,0)) //N?ha bugos ez?rt
return PLUGIN_HANDLED
if(get_user_flags(id) & JOG) // Itt is lek?rem a jogait.
{
new arg1[256], arg2[256];
read_argv(1,arg1,255);
read_argv(2,arg2,255);
new player = cmd_target(id,arg1,2);
if (equal(arg2,"1")) {
givedspec(player,1,id)
}
if (equal(arg2,"0")) {
givedspec(player,0,id);
}
}
else
{
set_hudmessage(255, 0, 0, -1.0, -1.0)
show_hudmessage(id, "[%s]: Nem vagy admin",error)
}
}
return PLUGIN_HANDLED
}
public givedspec(playerID,admin,adminID) {
new name[64];
get_user_name(playerID,name,63);
if(admin==1)
{
set_hudmessage(255, 0, 255, 0.0, 0.62, 0, 6.0, 12.0)
show_hudmessage(playerID, "[%s]: Mostantol nezo vagy!",prefix)
set_entity_visibility(playerID, 0);
set_user_godmode(playerID, 1)
strip_user_weapons(playerID)
cs_set_user_team(playerID, CS_TEAM_SPECTATOR)
}
if(admin==0)
{
set_hudmessage(255, 0, 255, 0.0, 0.62, 0, 6.0, 12.0)
show_hudmessage(playerID, "[%s]: Mostantol nem vagy jatekban!",prefix)
set_entity_visibility(playerID, 1);
set_user_godmode(playerID, 0)
cs_set_user_team(playerID, CS_TEAM_UNASSIGNED)
user_kill(playerID)
set_user_frags(playerID, 0)
cs_set_user_deaths(playerID,0)
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
*/