AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [EDIT] Team Changer (https://forums.alliedmods.net/showthread.php?t=185231)

TRUE RED 05-14-2012 11:38

[EDIT] Team Changer
 
can someone make the plugin that will transfer ONLY alive player to spec ONLY!

PHP Code:

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

new g_iMsgSayTextFloat:g_vSavedOrigin33 ][ ], bool:g_bWasAlive33 ];

public 
plugin_init( ) {
    
register_plugin"Team Changer""1.0""SchlumPF" );
    
    
register_clcmd"say /spec""CmdSpectator" );
    
register_clcmd"say /ct",   "CmdCounterTerrorist" );
    
register_clcmd"say /t",   "CmdTerrorist" );
    
    
g_iMsgSayText get_user_msgid"SayText" );
    
    
set_msg_blockget_user_msgid"ClCorpse" ), BLOCK_SET );
}

public 
CmdSpectator( const id ) {
    if( 
cs_get_user_teamid ) == CS_TEAM_SPECTATOR ) {
        
SendMessageid"^4[XJ] You are already a^3 spectator^4, say '^1/ct^4' to change your team." );
        
        return 
PLUGIN_HANDLED;
    }
    
    if( ( 
g_bWasAliveid ] = bool:is_user_aliveid ) ) )
        
entity_get_vectoridEV_VEC_origing_vSavedOriginid ] );
    
    
entity_set_intidEV_INT_deadflagDEAD_DISCARDBODY );
    
cs_set_user_teamidCS_TEAM_SPECTATOR );
    
    
SendMessageid"^4[XJ] You became a^3 spectator^1." );
    
    return 
PLUGIN_HANDLED;
}

public 
CmdCounterTerrorist( const id ) {
    if( 
cs_get_user_teamid ) == CS_TEAM_CT ) {
        
SendMessageid"^4[XJ] You are already a^3 counter-terrorist^4, say '^1/spec^4' to change your team." );
        
        return 
PLUGIN_HANDLED;
    }
    
    
cs_set_user_teamidCS_TEAM_CT );
    
    
ExecuteHamBHam_CS_RoundRespawnid );
    
    if( !
user_has_weaponidCSW_KNIFE ) )
        
give_itemid"weapon_knife" );
    
    if( !
user_has_weaponidCSW_USP ) ) {
        
give_itemid"weapon_usp" );
        
        
cs_set_user_bpammoidCSW_USP100 );
    }
    
    if( 
g_bWasAliveid ] ) {
        
g_bWasAliveid ] = false;
        
        
entity_set_originidg_vSavedOriginid ] );
    }
    
    
SendMessageid"^4[XJ] You became a^3 counter-terrorist^4." );
    
    return 
PLUGIN_HANDLED;
}

public 
CmdTerrorist( const id ) {
    if( 
cs_get_user_teamid ) == CS_TEAM_T ) {
        
SendMessageid"^4[XJ] You are already a^3 terrorist^4, say '^1/spec^4' to change your team." );
        
        return 
PLUGIN_HANDLED;
    }
    
    
cs_set_user_teamidCS_TEAM_T );
    
    
ExecuteHamBHam_CS_RoundRespawnid );
    
    if( !
user_has_weaponidCSW_KNIFE ) )
        
give_itemid"weapon_knife" );
    
    if( !
user_has_weaponidCSW_GLOCK18 ) ) {
        
give_itemid"weapon_glock18" );
        
        
cs_set_user_bpammoidCSW_GLOCK18120 );
    }
    
    if( 
g_bWasAliveid ] ) {
        
g_bWasAliveid ] = false;
        
        
entity_set_originidg_vSavedOriginid ] );
    }
    
    
SendMessageid"^4[XJ] You became a^3 terrorist^4." );
    
    return 
PLUGIN_HANDLED;
}

SendMessage( const id, const szMessage[ ] ) {
    
message_beginMSG_ONE_UNRELIABLE g_iMsgSayText_id );
    
write_byteid );
    
write_stringszMessage );
    
message_end( );



EpicMonkey 05-14-2012 12:24

Re: [EDIT] Team Changer
 
PHP Code:

if(!is_user_alive(id))
return 
PLUGIN_HANDLED 


TRUE RED 05-14-2012 14:40

Re: [EDIT] Team Changer
 
sorry, EpicMonkey, but i don't know what code to cut. This plugin has three functions (/ct/t/spec) i need only one (/spec). I think the code should be cut a lot but i have no idea how to do it. Can you make the whole code? Thanks!

Bilal Pro 05-14-2012 15:56

Re: [EDIT] Team Changer
 
PHP Code:

/* Plugin generated by AMXX-Studio */

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

#define PLUGIN "Invisible spectator"
#define VERSION "1.0"
#define AUTHOR "Bilal"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /spec""CmdSpec")
}

public 
CmdSpec(id)
{
    if (!(
is_user_alive(id)))
    {
        
client_print(idprint_chat"You have to be alive to use this command!")
        return 
PLUGIN_HANDLED
    
}
    if (
get_user_team(id) == 3)
    {
        
client_print(idprint_chat"You are already a spectator!")
        return 
PLUGIN_HANDLED
    
}
      
// switch team
    
cs_set_user_team(idCS_TEAM_SPECTATOR)

    
// respawn
    
ExecuteHam(Ham_CS_RoundRespawnid)

    
// rendering
    
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha0)
    
    
// effetcs
    
strip_user_weapons(id)
    
set_user_footsteps(id1)
    
set_user_godmode(id1)
    
    
// message
    
client_print(idprint_chat"You are a spectator now!")
    
    return 
PLUGIN_HANDLED


This would do it?

EDIT: Next time post this at suggestions/requests

TRUE RED 05-15-2012 06:35

Re: [EDIT] Team Changer
 
Hi, Bilal Pro! i have tested you plugin. when i type /spec i become invisible, and after i choose a team (for example terrorist) i start to play but still stay invisible. also when i'm spectator i'm walking and can pick up weapons then i can kill every player. also i'm walkin but not flying, can you fix all this bugs and make a spectator to fly not walk. thanks

EpicMonkey 05-15-2012 07:33

Re: [EDIT] Team Changer
 
Quote:

Originally Posted by TRUE RED (Post 1709274)
Hi, Bilal Pro! i have tested you plugin. when i type /spec i become invisible, and after i choose a team (for example terrorist) i start to play but still stay invisible. also when i'm spectator i'm walking and can pick up weapons then i can kill every player. also i'm walkin but not flying, can you fix all this bugs and make a spectator to fly not walk. thanks

lol ...........

TRUE RED 05-15-2012 07:39

Re: [EDIT] Team Changer
 
Quote:

Originally Posted by EpicMonkey
lol ...........

well, thank you for help...

Bilal Pro 05-15-2012 07:58

Re: [EDIT] Team Changer
 
You didnt ask for it either. second making it

Bilal Pro 05-15-2012 08:01

Re: [EDIT] Team Changer
 
PHP Code:

/* Plugin generated by AMXX-Studio */

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

#define PLUGIN "Invisible spectator"
#define VERSION "1.0"
#define AUTHOR "Bilal"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Spawn"player""Hamspawn"1)
    
    
register_clcmd("say /spec""CmdSpec")
}

public 
Hamspawn(id)
{
    if (
is_user_alive(id))
    {
        if (!(
get_user_team(id) == 3))
        {
            
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha500)
        }
    }
}

public 
CmdSpec(id)
{
    if (!(
is_user_alive(id)))
    {
        
client_print(idprint_chat"You have to be alive to use this command!")
        return 
PLUGIN_HANDLED
    
}
    if (
get_user_team(id) == 3)
    {
        
client_print(idprint_chat"You are already a spectator!")
        return 
PLUGIN_HANDLED
    
}
    
// switch team
    
cs_set_user_team(idCS_TEAM_SPECTATOR)
    
    
// respawn
    
ExecuteHam(Ham_CS_RoundRespawnid)
    
    
// rendering
    
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha0)
    
    
// effetcs
    
strip_user_weapons(id)
    
set_user_footsteps(id1)
    
set_user_godmode(id1)
    
    
// message
    
client_print(idprint_chat"You are a spectator now!")
    
    return 
PLUGIN_HANDLED



TRUE RED 05-15-2012 08:13

Re: [EDIT] Team Changer
 
2 Attachment(s)
look


All times are GMT -4. The time now is 00:21.

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