Hello to All
I made this plugin and I dont know how to do something.
Description:
If someone die it will open for him menu that asks if he want to go to spectator until next round
if yes its move him to spectator team and strip his weapons and set him invisable
and I need that will return the player to the same team he was when the round end, this is possible?
if someone know how tell me please

Thank's.
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <fun>
#include <fakemeta>
#include <engine>
#define PLUGIN "Invisible Spectator"
#define VERSION "1.0"
#define AUTHOR "author"
#define cm(%0) ( sizeof(%0) - 1 )
const m_afButtonPressed = 246;
new HamHook:g_iHhCBasePlayerObjectCaps;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
// Add your code here...
RegisterHam(Ham_Spawn, "player", "FwdPlayerSpawn", 1);
register_event("DeathMsg", "EventDeathMsg", "a" );
DisableHamForward(g_iHhCBasePlayerObjectCaps = RegisterHam(Ham_ObjectCaps, "player", "OnCBasePlayer_ObjectCaps", false));
register_touch("weaponbox", "player", "");
register_touch("armoury_entity", "player", "");
register_touch("weapon_shield", "player", "");
}
public FwdPlayerSpawn(id)
{
if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
{
set_task(0.3, "REMOVESPECA", id)
}
}
public EventDeathMsg(id)
{
new killer = read_data( 1 );
new victim = read_data( 2 );
if( killer == victim || ! is_user_connected( killer ) || ! is_user_connected( victim ) )
{
return PLUGIN_HANDLED;
//return;
}
SpecVictim(victim)
return PLUGIN_HANDLED;
}
public SpecVictim(id)
{
new menu = menu_create("\y[ \rInvisivle Spector \y] \wDo you want to go to Spector Team until this round end?", "SpecVictim_Handler" );
menu_additem(menu, "Yes", "", 0);
menu_additem(menu, "No", "", 0);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL );
menu_display(id, menu, 0 );
return PLUGIN_HANDLED;
}
public SpecVictim_Handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
switch(item)
{
case 0:
{
if (!is_user_alive(id))
{
ExecuteHam(Ham_CS_RoundRespawn,id);
cs_set_user_team(id, CS_TEAM_SPECTATOR)
set_task(0.3, "REMOVESPECA", id)
}
}
}
return PLUGIN_HANDLED;
}
public REMOVESPECA(id)
{
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0)
set_user_godmode(id, 1)
strip_user_weapons(id)
EnableHamForward(g_iHhCBasePlayerObjectCaps);
}
public OnCBasePlayer_ObjectCaps(id)
{
new buttons = pev(id, pev_button);
if( buttons & IN_USE )
{
set_pev(id, pev_button, buttons & ~IN_USE);
}
buttons = get_pdata_int(id, m_afButtonPressed);
if( buttons & IN_USE )
{
set_pdata_int(id, m_afButtonPressed, buttons & ~IN_USE);
}
return HAM_HANDLED;
}