Raised This Month: $ Target: $400
 0% 

[REQ]respawn as ghost when dead


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
asdfdsdf
AlliedModders Donor
Join Date: Aug 2010
Location: Belgium
Old 07-14-2013 , 17:18   [REQ]respawn as ghost when dead
Reply With Quote #1

Hello im searching for a plugin so dead terrorists can respawn as a ghost in game when they are dead they should need to type /ghost with menu that pops up Do you want to respawn as ghost yes no

alive players should not be able to see the ghosts is there a plugin public for that or can someone make that for me grtz
asdfdsdf is offline
K1d0x
Senior Member
Join Date: Apr 2012
Location: Copenhagen, Denmark
Old 07-15-2013 , 07:06   Re: [REQ]respawn as ghost when dead
Reply With Quote #2

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <hamsandwich>
#include <fun>

#define PLUGIN         "New Plug-In"
#define VERSION        "1.0"
#define AUTHOR         "K!D()X"

new gGhostMenu;
new 
HasGhost[33];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /ghost""AliveAsGhost");
    
RegisterHam(Ham_Spawn"player""SpawnPost"1);
    
    
gGhostMenu menu_create("Do you want to respawn as ghost?""MenuContent");
    
menu_additem(gGhostMenu"Yes""1");
    
menu_additem(gGhostMenu"No""2");
    
menu_setprop(gGhostMenuMPROP_EXITMEXIT_NEVER);
}

public 
client_putinserver(idHasGhost[id] = 0;

public 
AliveAsGhost(id) {
    if(
get_user_team(id) != 1) {
        
client_print(idprint_chat"Only Team Terrorists can use this Command !");
        return 
0;
    }
    
    if(
is_user_alive(id)) {
        
client_print(idprint_chat"This Command can be used only when you're dead !");
        return 
0;
    }
    
    
menu_display(idgGhostMenu);
    
    return 
0;
}

public 
SpawnPost(id) {
    if(
is_user_bot(id) && !is_user_alive(id))
        return 
0;
    
    if(
HasGhost[id])
        
set_user_rendering(idkRenderFxGlowShell000kRenderNormal25
    
    return 
0;
}

public 
MenuContent(idmenuitem) {
    if(
item 0)
        return 
0;
 
    new 
key[3];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccesskey2__callback);
    
    new 
szChoose str_to_num(key);
 
    switch(
szChoose) {
        case 
1: {
            
ExecuteHamB(Ham_CS_RoundRespawnid);
            
set_user_rendering(idkRenderFxNone000kRenderTransAlpha0);
            
            
HasGhost[id] = 1;
        }

        case 
2: {
            
/* Do Nothing */
        
}
    }

    return 
1;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{ rtf1 ansi deff0{ fonttbl{ f0 fnil Tahoma;}}n viewkind4 uc1 pard lang1033 f0 fs16 n par }
*/ 
__________________
I Hate people who can hate me !
K1d0x is offline
Send a message via Yahoo to K1d0x Send a message via Skype™ to K1d0x
ANTICHRISTUS
kingdom of weird stuff
Join Date: Jun 2010
Location: My kingdom is not in thi
Old 07-15-2013 , 07:45   Re: [REQ]respawn as ghost when dead
Reply With Quote #3

Quote:
Originally Posted by asdfdsdf View Post
.. is there a plugin public for that..
I only search in my archive and found this, did you really search ?
ps. I don't read the whole descriptions, sometimes only check titles. so I post as examples, not to be exactly the right answer .
__________________

Last edited by ANTICHRISTUS; 07-15-2013 at 07:46. Reason: spelling
ANTICHRISTUS is offline
asdfdsdf
AlliedModders Donor
Join Date: Aug 2010
Location: Belgium
Old 07-15-2013 , 11:43   Re: [REQ]respawn as ghost when dead
Reply With Quote #4

Quote:
Originally Posted by K1d0x View Post
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <hamsandwich>
#include <fun>

#define PLUGIN         "New Plug-In"
#define VERSION        "1.0"
#define AUTHOR         "K!D()X"

new gGhostMenu;
new 
HasGhost[33];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /ghost""AliveAsGhost");
    
RegisterHam(Ham_Spawn"player""SpawnPost"1);
    
    
gGhostMenu menu_create("Do you want to respawn as ghost?""MenuContent");
    
menu_additem(gGhostMenu"Yes""1");
    
menu_additem(gGhostMenu"No""2");
    
menu_setprop(gGhostMenuMPROP_EXITMEXIT_NEVER);
}

public 
client_putinserver(idHasGhost[id] = 0;

public 
AliveAsGhost(id) {
    if(
get_user_team(id) != 1) {
        
client_print(idprint_chat"Only Team Terrorists can use this Command !");
        return 
0;
    }
    
    if(
is_user_alive(id)) {
        
client_print(idprint_chat"This Command can be used only when you're dead !");
        return 
0;
    }
    
    
menu_display(idgGhostMenu);
    
    return 
0;
}

public 
SpawnPost(id) {
    if(
is_user_bot(id) && !is_user_alive(id))
        return 
0;
    
    if(
HasGhost[id])
        
set_user_rendering(idkRenderFxGlowShell000kRenderNormal25
    
    return 
0;
}

public 
MenuContent(idmenuitem) {
    if(
item 0)
        return 
0;
 
    new 
key[3];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccesskey2__callback);
    
    new 
szChoose str_to_num(key);
 
    switch(
szChoose) {
        case 
1: {
            
ExecuteHamB(Ham_CS_RoundRespawnid);
            
set_user_rendering(idkRenderFxNone000kRenderTransAlpha0);
            
            
HasGhost[id] = 1;
        }

        case 
2: {
            
/* Do Nothing */
        
}
    }

    return 
1;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{ rtf1 ansi deff0{ fonttbl{ f0 fnil Tahoma;}}n viewkind4 uc1 pard lang1033 f0 fs16 n par }
*/ 

this plugin works but if you can make so they cant kill any other people they respawn as ghost but people can still see when theyre talkin and the terrorist can still kill other cts its for a jailbreak server they need to be transparant if you know what i mean its just for dead players so they dont get bored of waiting grtz
asdfdsdf is offline
K1d0x
Senior Member
Join Date: Apr 2012
Location: Copenhagen, Denmark
Old 07-16-2013 , 12:33   Re: [REQ]respawn as ghost when dead
Reply With Quote #5

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <engine>
#include <cstrike>
#include <hamsandwich>
#include <fun>

#define PLUGIN         "New Plug-In"
#define VERSION        "1.0"
#define AUTHOR         "K!D()X"

#define DMG_HEGRENADE  (1<<24)

new gGhostMenu;
new 
HasGhost[33];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /ghost""AliveAsGhost");
    
RegisterHam(Ham_Spawn"player""SpawnPost"1);
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage");
    
    
gGhostMenu menu_create("Do you want to respawn as ghost?""MenuContent");
    
menu_additem(gGhostMenu"Yes""1");
    
menu_additem(gGhostMenu"No""2");
    
menu_setprop(gGhostMenuMPROP_EXITMEXIT_NEVER);
}

public 
client_putinserver(idHasGhost[id] = 0;

public 
AliveAsGhost(id) {
    if(
cs_get_user_team(id) != CS_TEAM_T) {
        
client_print(idprint_chat"Only Team Terrorists can use this Command !");
        return 
0;
    }
    
    if(
is_user_alive(id)) {
        
client_print(idprint_chat"This Command can be used only when you're dead !");
        return 
0;
    }
    
    
HasGhost[id] = 0;
    
menu_display(idgGhostMenu);
    
    return 
0;
}

public 
SpawnPost(id) {
    if(
is_user_bot(id) && !is_user_alive(id))
        return 
0;
    
    if(
HasGhost[id])
        
set_user_rendering(idkRenderFxGlowShell000kRenderNormal25)
    
    return 
0;
}

public 
MenuContent(idmenuitem) {
    if(
item 0)
        return 
0;
    
    new 
key[3];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccesskey2__callback);
    
    new 
szChoose str_to_num(key);
    
    switch(
szChoose) {
        case 
1: {
            
ExecuteHamB(Ham_CS_RoundRespawnid);
            
set_user_rendering(idkRenderFxNone000kRenderTransAlpha0);
            
cs_set_user_team(idCS_TEAM_T);
            
            
HasGhost[id] = 1;
        }
        
        case 
2: {
            
/* Do Nothing */
        
}
    }
    
    return 
1;
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type) {
    
/* Self damage */
    
if(victim == attacker) { return HAM_IGNORED; }
    
    
/* Attacker is't GHOST */
    
if(!HasGhost[attacker]) { return HAM_IGNORED; }
    
    
/* Prevent Friendly Fire if is allowed */
    
if(cs_get_user_team(attacker) == cs_get_user_team(victim)) { return HAM_SUPERCEDE; }
    
    
/* Prevent Friendly Fire if is allowed */
    
if(cs_get_user_team(attacker) != cs_get_user_team(victim)) { return HAM_SUPERCEDE; }
    
    return 
HAM_IGNORED;
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{ rtf1 ansi deff0{ fonttbl{ f0 fnil Tahoma;}}n viewkind4 uc1 pard lang1033 f0 fs16 n par }
*/ 
Recommanded is to strip ghost weapons (Primary, Secondary and Knife) it's more easy
__________________
I Hate people who can hate me !

Last edited by K1d0x; 07-16-2013 at 12:49.
K1d0x is offline
Send a message via Yahoo to K1d0x Send a message via Skype™ to K1d0x
asdfdsdf
AlliedModders Donor
Join Date: Aug 2010
Location: Belgium
Old 07-16-2013 , 15:36   Re: [REQ]respawn as ghost when dead
Reply With Quote #6

It doesnt work as i want it when a dead player respawns as ghost he stil lcan slash the ct and in scoreboard he appears as alive it should be more a spectator mode when ct walks forward to the ghost he gets blocked they should need to be transparant so no one noticed the ghost is there grtz
asdfdsdf is offline
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 07-16-2013 , 23:34   Re: [REQ]respawn as ghost when dead
Reply With Quote #7

Use the links ANTICHRISTUS posted.
DruGzOG is offline
Send a message via AIM to DruGzOG
K1d0x
Senior Member
Join Date: Apr 2012
Location: Copenhagen, Denmark
Old 07-16-2013 , 23:37   Re: [REQ]respawn as ghost when dead
Reply With Quote #8

Ghost:
- can not use radio commands
- can not buy weapons
- can not attack other players
- at respawn will got only knife
- in score board will appear as dead
- in chat will appear as dead
- is invisible and not solid
- will revive respawn in last origin

If you want something like this then i wait for your reply
__________________
I Hate people who can hate me !

Last edited by K1d0x; 07-16-2013 at 23:39.
K1d0x is offline
Send a message via Yahoo to K1d0x Send a message via Skype™ to K1d0x
sonel
Member
Join Date: Jul 2012
Old 07-17-2013 , 01:20   Re: [REQ]respawn as ghost when dead
Reply With Quote #9

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>
#include <fakemeta>
#include <hamsandwich>


#define PLUGIN "Fantasma"
#define VERSION "1.0"
#define AUTHOR "sonel"


#define SetBits(%1,%2)       %1 |= 1<<(%2 & 31)
#define DelBits(%1,%2)   %1 &= ~(1<<(%2 & 31))
#define GetBits(%1,%2)       %1 &  1<<(%2 & 31)
#define MAX_PLAYERS             32 + 1
#define SB_ATTRIB_DEAD          1<<0

#define XO_WEAPONS              4
#define m_pPlayer               41

#define m_flNextPrimaryAttack   46
#define m_flNextSecondaryAttack 47

new g_bIsConnectedg_bIsAliveg_bIsSpectator
new bool:g_bIsGhost[MAX_PLAYERS]



new 
g_iMaxPlayers
new bool:g_bStartSemiclip
new bool:g_bBombIsPlanted
new bool:g_bRoundEnd
new g_ScoreAttrib


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_ScoreAttrib get_user_msgid("ScoreAttrib")
    
    
register_message(g_ScoreAttrib"MsgScoreAttrib")
    
    
register_clcmd("say /ghost" "fantasma")
    
register_clcmd("say_team /ghost" "fantasma")
    
register_clcmd("say /fantasma" "fantasma")
    
register_clcmd("say_team /fantasma" "fantasma")
    
    
    
register_event("HLTV""ev_NewRound""a""1=0""2=0")
    
register_event"CurWeapon""evCurWeapon" "be" "1=1" "2!29" );
    
g_iMaxPlayers get_maxplayers()
    
    
register_forward(FM_CmdStart"CmdStart")  
    
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn"1)
    
    
register_clcmd("radio1""BlockCmd")
    
register_clcmd("radio2""BlockCmd")
    
register_clcmd("radio3""BlockCmd")
    
    
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled"1)
    
RegisterHam(Ham_Player_PreThink"player""fw_PreThink_Post"1)
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_knife""fw_KnifePrimaryAttack")
    
RegisterHam(Ham_Weapon_SecondaryAttack"weapon_knife""fw_KnifeSecondaryAttack")
    
register_forward(FM_AddToFullPack"fw_AddToFullPack_Post"1)
    
    
    
    
register_logevent("ev_FunctionP"3"2=Planted_The_Bomb")
    
register_logevent("ev_RoundEnd",2,"1=Round_End")
    
    
    
RegisterHamHam_Touch"armoury_entity""Ham_WeaponTouch_Pre",)
    
RegisterHamHam_Touch"weaponbox""Ham_WeaponTouch_Pre")
    
    
register_message(get_user_msgid("StatusIcon"), "Message_StatusIcon");
    
}




public 
client_putinserver(id)
{
    
g_bIsGhost[id] = false
    
    
    DelBits
(g_bIsSpectatorid)
    
DelBits(g_bIsAliveid)
    
SetBits(g_bIsConnectedid)
    
}

public 
client_disconnect(id)
{
    
g_bIsGhost[id] = false
    
    
    DelBits
(g_bIsSpectatorid)
    
DelBits(g_bIsAliveid)
    
DelBits(g_bIsConnectedid)
    
    if(!
IsAlive(CS_TEAM_CT) || !IsAlive(CS_TEAM_T) && !g_bBombIsPlanted)
    {
        
ForceRoundEnd()
    }
    
}



public 
ev_FunctionP()
{
    
g_bBombIsPlanted true
}

public 
fantasma(id)
{
    if( 
is_user_aliveid ) )
    {
        
client_printidprint_chat"You can only be ghost when dead!")
        return 
PLUGIN_HANDLED;
    }
    
    new 
CsTeams:iTeam cs_get_user_team(id)
    if(
iTeam == CS_TEAM_T || iTeam == CS_TEAM_CT)
    {
        
RespawnGhost(id)
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_HANDLED;
    
    
//return PLUGIN_HANDLED;
    /*
    if( is_user_alive( id ) )
    {
        client_print( id, print_chat, "Queres renascer vivo? Deves estar maluco!")
        return PLUGIN_HANDLED;
    }
    
    new CsTeams:iTeam = cs_get_user_team(id)
    if(iTeam == CS_TEAM_T || iTeam == CS_TEAM_CT)

    ExecuteHamB(Ham_CS_RoundRespawn,id)
    //set_task(0.5, "efeitosfantasma", id)
    g_bIsGhost[id] = true;
    //g_bStartSemiclip = true;
    
    
    return PLUGIN_HANDLED;
    */
}


public 
ev_NewRound()
{
    
g_bRoundEnd false
    g_bBombIsPlanted 
false
    
    
for(new 1<= g_iMaxPlayersi++) 
    {
        if(
GetBits(g_bIsConnectedi))
        {
            
            
            if(
g_bIsGhost[i])
            {
                
cs_set_user_deaths(ics_get_user_deaths(i) - 1)
                
                
set_user_footsteps(i0)
                
//set_user_rendering(i)
                
g_bStartSemiclip false
                
                set_pev
(ipev_takedamageDAMAGE_AIM)
            
                
            }
            
g_bIsGhost[i] = false
        
}
    }
}


public 
ev_RoundEnd()
{
    if(!
g_bRoundEnd)
    {
        
ForceRoundEnd()
    }
}


public 
RespawnGhost(id)
{
    if(!
g_bRoundEnd)
    {
    
        
g_bStartSemiclip true    
        g_bIsGhost
[id] = true
        ExecuteHamB
(Ham_CS_RoundRespawnid)
    }
    
    
}



public 
fw_PlayerSpawn(id
{
    if(
is_user_alive(id))
    {
        
SetBits(g_bIsAliveid)
        
DelBits(g_bIsSpectatorid)
        
        
        if(
g_bIsGhost[id])
        {
            
            
StripWeapons(id)
            
SetUserGhost(id)
        }
    }
}

public 
fw_PlayerKilled(id)
{
    
DelBits(g_bIsAliveid)
    
    if(!
g_bRoundEnd)
    {
        if(!
IsAlive(CS_TEAM_CT) || !IsAlive(CS_TEAM_T) && !g_bBombIsPlanted)
        {
            
ForceRoundEnd()
            
        }
}    }


public 
StripWeapons(id)
{

    if(
GetBits(g_bIsAliveid) && g_bIsGhost[id])
    {
        
strip_user_weapons(id)
        
give_item(id"weapon_knife")
    }
}





public 
MsgScoreAttrib()
{
    new 
id get_msg_arg_int(1)
    
    if(
g_bIsGhost[id])
    {
        
set_msg_arg_int(2ARG_BYTESB_ATTRIB_DEAD)
    }
}


public 
fw_KnifePrimaryAttack(iEnt)
{
    new 
id get_pdata_cbase(iEntm_pPlayerXO_WEAPONS)
    if(
g_bIsGhost[id])
    {
        
set_pdata_float(iEntm_flNextPrimaryAttack20.0XO_WEAPONS)
        return 
HAM_SUPERCEDE
    

    return 
HAM_IGNORED
}

public 
fw_KnifeSecondaryAttack(iEnt)
{
    new 
id get_pdata_cbase(iEntm_pPlayerXO_WEAPONS)
    if(
g_bIsGhost[id])
    {
        
set_pdata_float(iEntm_flNextSecondaryAttack20.0XO_WEAPONS)
        return 
HAM_SUPERCEDE
    

    return 
HAM_IGNORED
}

public 
evCurWeaponid )
{
    if(
g_bIsGhost[id])
    {
        
        
engclient_cmdid "weapon_knife" );
    }
}


public 
fw_PreThink_Post(id)
{
        if(
g_bIsGhost[id])
        {
        
set_pev(idpev_takedamageDAMAGE_NO)
        }
    
        if(
g_bStartSemiclip)
        {
            if(!(
GetBits(g_bIsAliveid)))
                return
            
            static 
i
            
for(1<= g_iMaxPlayersi++)
            {
                if(
g_bIsGhost[id] != g_bIsGhost[i] || g_bIsGhost[id] && !g_bIsGhost[i])
                {
                    if(
GetBits(g_bIsAlivei))
                        
set_pev(ipev_solidSOLID_NOT)
                }
            }
        }
    
}




public 
client_PostThink(id)
{
    
        if(
g_bStartSemiclip)
        {
            if(!(
GetBits(g_bIsAliveid)))
                return
            
            static 
i
            
for(1<= g_iMaxPlayersi++)
            {
                if(
id != i)
                {    
                    if(
GetBits(g_bIsAlivei)) //&& !g_bIsGhost[i])
                        
set_pev(ipev_solidSOLID_SLIDEBOX)
                }
            }
        }
    
}



public 
fw_AddToFullPack_Post(eseenthosthostflagsplayerpSet)
{
    if(!
player || !get_orig_retval() || !(GetBits(g_bIsAlivehost)) && !(GetBits(g_bIsSpectatorhost)) || !g_bStartSemiclip)
    {
        return 
FMRES_IGNORED
    
}
    
    if(
host != ent)
    {
        
set_es(esES_SolidSOLID_NOT)
        if(
g_bIsGhost[ent])
            {
                
set_es(esES_RenderFxkRenderFxHologram//kRenderFxDistort) //: 
                
set_es(esES_RenderModekRenderTransAdd)
                
set_es(esES_RenderAmt175)
                
                if(!
g_bIsGhost[host])
                {
                    
set_es(esES_Effectsget_es(esES_Effects) | EF_NODRAW)
                    
set_es(esES_OriginFloat:{99999.9,99999.9,99999.9})
                }
            }
    }
    return 
FMRES_IGNORED



public 
CmdStart(idHandle
{
    
    
    if(
is_user_alive(id)) 
    {
        
        if(
g_bIsGhost[id])
        {
        static 
button
        button 
get_uc(HandleUC_Buttons)
        
        if (
button IN_USE
        {
  
            
button &= ~IN_USE // This blocks Use. I'd rather prefer blocking use while pressing both. So i comment button &= ~IN_ATTACK
     
        
}
        
        
set_uc(HandleUC_Buttonsbutton)
        }
                        
    }
}  
    

public 
Ham_WeaponTouch_PreiEntityid )
{
    if( !
is_user_aliveid ) )
    {
        return 
HAM_IGNORED;
    }
        
    if(
g_bIsGhost[id])
    {
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;
}


public 
BlockCmd(id)
{
    return 
g_bIsGhost[id] ? PLUGIN_HANDLED PLUGIN_CONTINUE




public 
Message_StatusIcon(iMsgIdiMsgDestid
{
    if(!
g_bIsGhost[id])
    {
    return 
PLUGIN_CONTINUE;
    }
   
    static 
szIcon[8]; 
    
get_msg_arg_string(2szIconcharsmax(szIcon)); 
    if( 
equal(szIcon"buyzone") )
    { 
        if( 
get_msg_arg_int(1) ) 
        { 
            
set_pdata_int(id235get_pdata_int(id235) & ~(1<<0));
            return 
PLUGIN_HANDLED
        } 
    } 
     
    return 
PLUGIN_CONTINUE
}





IsAlive(CsTeams:iTeam
{
    new 
iAliveNum 
    
    
for(new 1<= g_iMaxPlayersi++) 
    {
        if(
GetBits(g_bIsAlivei) && cs_get_user_team(i) == iTeam && !g_bIsGhost[i])
        {
            
iAliveNum++ 
        }
    }
    return 
iAliveNum 
}



ForceRoundEnd() 

    
g_bRoundEnd true
    
    
for(new 1<= g_iMaxPlayersi++) 
    {
        if(
GetBits(g_bIsAlivei) && g_bIsGhost[i])
        {
            
set_pev(ipev_takedamageDAMAGE_AIM)
            
set_pev(ipev_movetypeMOVETYPE_WALK)
            
user_silentkill(i)
        }
    }
}  

SetUserGhost(id
{
    
set_user_footsteps(id1)
    
    
    
set_pev(idpev_takedamageDAMAGE_NO)
    

sonel is offline
asdfdsdf
AlliedModders Donor
Join Date: Aug 2010
Location: Belgium
Old 07-22-2013 , 17:09   Re: [REQ]respawn as ghost when dead
Reply With Quote #10

Quote:
Originally Posted by sonel View Post
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>
#include <fakemeta>
#include <hamsandwich>


#define PLUGIN "Fantasma"
#define VERSION "1.0"
#define AUTHOR "sonel"


#define SetBits(%1,%2)       %1 |= 1<<(%2 & 31)
#define DelBits(%1,%2)   %1 &= ~(1<<(%2 & 31))
#define GetBits(%1,%2)       %1 &  1<<(%2 & 31)
#define MAX_PLAYERS             32 + 1
#define SB_ATTRIB_DEAD          1<<0

#define XO_WEAPONS              4
#define m_pPlayer               41

#define m_flNextPrimaryAttack   46
#define m_flNextSecondaryAttack 47

new g_bIsConnectedg_bIsAliveg_bIsSpectator
new bool:g_bIsGhost[MAX_PLAYERS]



new 
g_iMaxPlayers
new bool:g_bStartSemiclip
new bool:g_bBombIsPlanted
new bool:g_bRoundEnd
new g_ScoreAttrib


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_ScoreAttrib get_user_msgid("ScoreAttrib")
    
    
register_message(g_ScoreAttrib"MsgScoreAttrib")
    
    
register_clcmd("say /ghost" "fantasma")
    
register_clcmd("say_team /ghost" "fantasma")
    
register_clcmd("say /fantasma" "fantasma")
    
register_clcmd("say_team /fantasma" "fantasma")
    
    
    
register_event("HLTV""ev_NewRound""a""1=0""2=0")
    
register_event"CurWeapon""evCurWeapon" "be" "1=1" "2!29" );
    
g_iMaxPlayers get_maxplayers()
    
    
register_forward(FM_CmdStart"CmdStart")  
    
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn"1)
    
    
register_clcmd("radio1""BlockCmd")
    
register_clcmd("radio2""BlockCmd")
    
register_clcmd("radio3""BlockCmd")
    
    
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled"1)
    
RegisterHam(Ham_Player_PreThink"player""fw_PreThink_Post"1)
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_knife""fw_KnifePrimaryAttack")
    
RegisterHam(Ham_Weapon_SecondaryAttack"weapon_knife""fw_KnifeSecondaryAttack")
    
register_forward(FM_AddToFullPack"fw_AddToFullPack_Post"1)
    
    
    
    
register_logevent("ev_FunctionP"3"2=Planted_The_Bomb")
    
register_logevent("ev_RoundEnd",2,"1=Round_End")
    
    
    
RegisterHamHam_Touch"armoury_entity""Ham_WeaponTouch_Pre",)
    
RegisterHamHam_Touch"weaponbox""Ham_WeaponTouch_Pre")
    
    
register_message(get_user_msgid("StatusIcon"), "Message_StatusIcon");
    
}




public 
client_putinserver(id)
{
    
g_bIsGhost[id] = false
    
    
    DelBits
(g_bIsSpectatorid)
    
DelBits(g_bIsAliveid)
    
SetBits(g_bIsConnectedid)
    
}

public 
client_disconnect(id)
{
    
g_bIsGhost[id] = false
    
    
    DelBits
(g_bIsSpectatorid)
    
DelBits(g_bIsAliveid)
    
DelBits(g_bIsConnectedid)
    
    if(!
IsAlive(CS_TEAM_CT) || !IsAlive(CS_TEAM_T) && !g_bBombIsPlanted)
    {
        
ForceRoundEnd()
    }
    
}



public 
ev_FunctionP()
{
    
g_bBombIsPlanted true
}

public 
fantasma(id)
{
    if( 
is_user_aliveid ) )
    {
        
client_printidprint_chat"You can only be ghost when dead!")
        return 
PLUGIN_HANDLED;
    }
    
    new 
CsTeams:iTeam cs_get_user_team(id)
    if(
iTeam == CS_TEAM_T || iTeam == CS_TEAM_CT)
    {
        
RespawnGhost(id)
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_HANDLED;
    
    
//return PLUGIN_HANDLED;
    /*
    if( is_user_alive( id ) )
    {
        client_print( id, print_chat, "Queres renascer vivo? Deves estar maluco!")
        return PLUGIN_HANDLED;
    }
    
    new CsTeams:iTeam = cs_get_user_team(id)
    if(iTeam == CS_TEAM_T || iTeam == CS_TEAM_CT)

    ExecuteHamB(Ham_CS_RoundRespawn,id)
    //set_task(0.5, "efeitosfantasma", id)
    g_bIsGhost[id] = true;
    //g_bStartSemiclip = true;
    
    
    return PLUGIN_HANDLED;
    */
}


public 
ev_NewRound()
{
    
g_bRoundEnd false
    g_bBombIsPlanted 
false
    
    
for(new 1<= g_iMaxPlayersi++) 
    {
        if(
GetBits(g_bIsConnectedi))
        {
            
            
            if(
g_bIsGhost[i])
            {
                
cs_set_user_deaths(ics_get_user_deaths(i) - 1)
                
                
set_user_footsteps(i0)
                
//set_user_rendering(i)
                
g_bStartSemiclip false
                
                set_pev
(ipev_takedamageDAMAGE_AIM)
            
                
            }
            
g_bIsGhost[i] = false
        
}
    }
}


public 
ev_RoundEnd()
{
    if(!
g_bRoundEnd)
    {
        
ForceRoundEnd()
    }
}


public 
RespawnGhost(id)
{
    if(!
g_bRoundEnd)
    {
    
        
g_bStartSemiclip true    
        g_bIsGhost
[id] = true
        ExecuteHamB
(Ham_CS_RoundRespawnid)
    }
    
    
}



public 
fw_PlayerSpawn(id
{
    if(
is_user_alive(id))
    {
        
SetBits(g_bIsAliveid)
        
DelBits(g_bIsSpectatorid)
        
        
        if(
g_bIsGhost[id])
        {
            
            
StripWeapons(id)
            
SetUserGhost(id)
        }
    }
}

public 
fw_PlayerKilled(id)
{
    
DelBits(g_bIsAliveid)
    
    if(!
g_bRoundEnd)
    {
        if(!
IsAlive(CS_TEAM_CT) || !IsAlive(CS_TEAM_T) && !g_bBombIsPlanted)
        {
            
ForceRoundEnd()
            
        }
}    }


public 
StripWeapons(id)
{

    if(
GetBits(g_bIsAliveid) && g_bIsGhost[id])
    {
        
strip_user_weapons(id)
        
give_item(id"weapon_knife")
    }
}





public 
MsgScoreAttrib()
{
    new 
id get_msg_arg_int(1)
    
    if(
g_bIsGhost[id])
    {
        
set_msg_arg_int(2ARG_BYTESB_ATTRIB_DEAD)
    }
}


public 
fw_KnifePrimaryAttack(iEnt)
{
    new 
id get_pdata_cbase(iEntm_pPlayerXO_WEAPONS)
    if(
g_bIsGhost[id])
    {
        
set_pdata_float(iEntm_flNextPrimaryAttack20.0XO_WEAPONS)
        return 
HAM_SUPERCEDE
    

    return 
HAM_IGNORED
}

public 
fw_KnifeSecondaryAttack(iEnt)
{
    new 
id get_pdata_cbase(iEntm_pPlayerXO_WEAPONS)
    if(
g_bIsGhost[id])
    {
        
set_pdata_float(iEntm_flNextSecondaryAttack20.0XO_WEAPONS)
        return 
HAM_SUPERCEDE
    

    return 
HAM_IGNORED
}

public 
evCurWeaponid )
{
    if(
g_bIsGhost[id])
    {
        
        
engclient_cmdid "weapon_knife" );
    }
}


public 
fw_PreThink_Post(id)
{
        if(
g_bIsGhost[id])
        {
        
set_pev(idpev_takedamageDAMAGE_NO)
        }
    
        if(
g_bStartSemiclip)
        {
            if(!(
GetBits(g_bIsAliveid)))
                return
            
            static 
i
            
for(1<= g_iMaxPlayersi++)
            {
                if(
g_bIsGhost[id] != g_bIsGhost[i] || g_bIsGhost[id] && !g_bIsGhost[i])
                {
                    if(
GetBits(g_bIsAlivei))
                        
set_pev(ipev_solidSOLID_NOT)
                }
            }
        }
    
}




public 
client_PostThink(id)
{
    
        if(
g_bStartSemiclip)
        {
            if(!(
GetBits(g_bIsAliveid)))
                return
            
            static 
i
            
for(1<= g_iMaxPlayersi++)
            {
                if(
id != i)
                {    
                    if(
GetBits(g_bIsAlivei)) //&& !g_bIsGhost[i])
                        
set_pev(ipev_solidSOLID_SLIDEBOX)
                }
            }
        }
    
}



public 
fw_AddToFullPack_Post(eseenthosthostflagsplayerpSet)
{
    if(!
player || !get_orig_retval() || !(GetBits(g_bIsAlivehost)) && !(GetBits(g_bIsSpectatorhost)) || !g_bStartSemiclip)
    {
        return 
FMRES_IGNORED
    
}
    
    if(
host != ent)
    {
        
set_es(esES_SolidSOLID_NOT)
        if(
g_bIsGhost[ent])
            {
                
set_es(esES_RenderFxkRenderFxHologram//kRenderFxDistort) //: 
                
set_es(esES_RenderModekRenderTransAdd)
                
set_es(esES_RenderAmt175)
                
                if(!
g_bIsGhost[host])
                {
                    
set_es(esES_Effectsget_es(esES_Effects) | EF_NODRAW)
                    
set_es(esES_OriginFloat:{99999.9,99999.9,99999.9})
                }
            }
    }
    return 
FMRES_IGNORED



public 
CmdStart(idHandle
{
    
    
    if(
is_user_alive(id)) 
    {
        
        if(
g_bIsGhost[id])
        {
        static 
button
        button 
get_uc(HandleUC_Buttons)
        
        if (
button IN_USE
        {
  
            
button &= ~IN_USE // This blocks Use. I'd rather prefer blocking use while pressing both. So i comment button &= ~IN_ATTACK
     
        
}
        
        
set_uc(HandleUC_Buttonsbutton)
        }
                        
    }
}  
    

public 
Ham_WeaponTouch_PreiEntityid )
{
    if( !
is_user_aliveid ) )
    {
        return 
HAM_IGNORED;
    }
        
    if(
g_bIsGhost[id])
    {
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;
}


public 
BlockCmd(id)
{
    return 
g_bIsGhost[id] ? PLUGIN_HANDLED PLUGIN_CONTINUE




public 
Message_StatusIcon(iMsgIdiMsgDestid
{
    if(!
g_bIsGhost[id])
    {
    return 
PLUGIN_CONTINUE;
    }
   
    static 
szIcon[8]; 
    
get_msg_arg_string(2szIconcharsmax(szIcon)); 
    if( 
equal(szIcon"buyzone") )
    { 
        if( 
get_msg_arg_int(1) ) 
        { 
            
set_pdata_int(id235get_pdata_int(id235) & ~(1<<0));
            return 
PLUGIN_HANDLED
        } 
    } 
     
    return 
PLUGIN_CONTINUE
}





IsAlive(CsTeams:iTeam
{
    new 
iAliveNum 
    
    
for(new 1<= g_iMaxPlayersi++) 
    {
        if(
GetBits(g_bIsAlivei) && cs_get_user_team(i) == iTeam && !g_bIsGhost[i])
        {
            
iAliveNum++ 
        }
    }
    return 
iAliveNum 
}



ForceRoundEnd() 

    
g_bRoundEnd true
    
    
for(new 1<= g_iMaxPlayersi++) 
    {
        if(
GetBits(g_bIsAlivei) && g_bIsGhost[i])
        {
            
set_pev(ipev_takedamageDAMAGE_AIM)
            
set_pev(ipev_movetypeMOVETYPE_WALK)
            
user_silentkill(i)
        }
    }
}  

SetUserGhost(id
{
    
set_user_footsteps(id1)
    
    
    
set_pev(idpev_takedamageDAMAGE_NO)
    


this plugin works great man but the only problem is that ghosts on this plugin can touch the ball of the pluginn from jailballmenu is it possible to make so they cant touch the ball also grtz thx for the reply
asdfdsdf 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 09:09.


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