Raised This Month: $ Target: $400
 0% 

[HELP]Return user to team.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ShLuMieL
Senior Member
Join Date: Jul 2010
Old 01-03-2014 , 14:32   Re: [HELP]Return user to team.
Reply With Quote #10

Juk helped me with that yesterday on skype

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;  

new 
gTeams[33];

public 
plugin_init() { 
    
register_plugin(PLUGINVERSIONAUTHOR
    
    
// Add your code here... 
    
    
register_clcmd("say /gospec""SpecVictim");
    
RegisterHam(Ham_Spawn"player""FwdPlayerSpawn"1);
    
register_logevent("logevent_round_end"2"1=Round_End")
    
register_event("DeathMsg""EventDeathMsg""a" );
    
DisableHamForward(g_iHhCBasePlayerObjectCaps RegisterHam(Ham_ObjectCaps"player""OnCBasePlayer_ObjectCaps"false));
    
    
RegisterHam(Ham_Touch"armoury_entity""blockOperationArmor");
    
RegisterHam(Ham_Touch"weaponbox""blockOperationWeapon");
    
RegisterHam(Ham_Touch"weapon_shield""blockOperationShield")
}

public 
FwdPlayerSpawn(id)
{
    
give_item(id"weapon_knife")
    
set_user_godmode(id0)
    
DisableHamForward(g_iHhCBasePlayerObjectCaps);
}

public 
logevent_round_end()
{
    for(new 
32 ++)
    {
        if(
is_user_connected(i) && (cs_get_user_team(i) == CS_TEAM_SPECTATOR))
        {
            if(
gTeams[i] != 0)
            {
                
cs_set_user_team(igTeams[i]);
                
gTeams[i] = 0;
            }
        }
    }
}

public 
EventDeathMsg(id)
{
    new 
killer read_data);
    new 
victim read_data);
    
    if( 
killer == victim || ! is_user_connectedkiller ) || ! is_user_connectedvictim ) )
    {
        return 
PLUGIN_HANDLED;
        
//return;
    
}
    
    if(
cs_get_user_team(victim) != CS_TEAM_SPECTATOR)
    {
        
set_task(0.5"SpecVictim"victim)
    }
    
    return 
PLUGIN_HANDLED;
}

public 
SpecVictim(id)
{
    if (!
is_user_alive(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(menuMPROP_EXITMEXIT_ALL);
        
menu_display(idmenu0);
    }
    
    return 
PLUGIN_HANDLED;
}

public 
SpecVictim_Handler(idmenuitem
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    switch(
item)
    {
        case 
0:
        {
            if (!
is_user_alive(id) && cs_get_user_team(id) != CS_TEAM_SPECTATOR)
            {
                
ExecuteHam(Ham_CS_RoundRespawn,id);
                
gTeams[id] = get_user_team(id)
                
cs_set_user_team(idCS_TEAM_SPECTATOR)
                
REMOVESPECA(id)
            }    
        }
    }
    
    return 
PLUGIN_HANDLED;
}

public 
REMOVESPECA(id
{
    if(
cs_get_user_team(id) == CS_TEAM_SPECTATOR)
    {
        
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha0)
        
set_user_godmode(id1)
        
strip_user_weapons(id)
        
EnableHamForward(g_iHhCBasePlayerObjectCaps);
        
        
set_task(0.1"REMOVESPECA"id)
    }
}

// BLOCK OPERATION
///////////////////////////////////////////
public blockOperationArmor(id)
{
    return (
cs_get_user_team(id) == CS_TEAM_SPECTATOR) ?  HAM_SUPERCEDE HAM_IGNORED
}

public 
blockOperationShield(id)
{
    return (
cs_get_user_team(id) == CS_TEAM_SPECTATOR) ?  HAM_SUPERCEDE HAM_IGNORED
}

public 
blockOperationWeapon(weaponboxid)
{
    return (
cs_get_user_team(id) == CS_TEAM_SPECTATOR) ?  HAM_SUPERCEDE HAM_IGNORED
}

// BLOCK E KEY
///////////////////////////////////////////
public OnCBasePlayer_ObjectCaps(id)  
{  
    new 
buttons pev(idpev_button);  
    if( 
buttons IN_USE )  
    {  
        
set_pev(idpev_buttonbuttons & ~IN_USE);  
    }  
    
buttons get_pdata_int(idm_afButtonPressed);  
    if( 
buttons IN_USE )  
    {  
        
set_pdata_int(idm_afButtonPressedbuttons & ~IN_USE);  
    }  
    return 
HAM_HANDLED;  

ShLuMieL is offline
 



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 10:14.


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