AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   button M go Spec button M again go CT For Ljserver (https://forums.alliedmods.net/showthread.php?t=174522)

sb123 12-21-2011 14:44

button M go Spec button M again go CT For Ljserver
 
hello

my ljserver n eed this pluings

some player want go spec see other people

when go Ct again don't dead my lj server not auto spawn plugins

Erox902 01-01-2012 12:40

Re: button M go Spec button M again go CT For Ljserver
 
Try if this works the way you want it to.

It's a quite simple plugin, two cvars to use:
  • spec_announcement -Change this to 0 if you don't want to send a chatmsg information about which player did what.
  • spec_deathmessage -Change to 1 if you want the players that turns to spectator to show in the deathmsg. ( Up in the right corner by default )

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>

new const gszPrefix[] = "[CTR]"
new gCvarDeathMsg
new gCvarAnnouncement

public plugin_init()
{
    
register_plugin"ChooseteamReplacement""1.0""Rtk.Esc")
    
register_clcmd"chooseteam""replace_function" )
    
gCvarAnnouncement register_cvar"spec_announcement""1" )
    
gCvarDeathMsg register_cvar"spec_deathmessage""0" )
}

public 
replace_function(id)
{
    static 
Name[34]
    
get_user_nameidNamecharsmax(Name) )
    
    new 
iAnnounce get_pcvar_numgCvarAnnouncement )
    
    if ( 
cs_get_user_team(id) != CS_TEAM_CT )
    {
        
cs_set_user_teamidCS_TEAM_CT )
        
ExecuteHamBHam_CS_RoundRespawnid )
        
        if ( 
iAnnounce )
            
client_print0print_chat"%s%s respawned as Ct again"gszPrefixName )
    }
    else
    {
        
cs_set_user_teamidCS_TEAM_SPECTATOR )
        
        if ( 
get_pcvar_numgCvarDeathMsg ) )
            
user_kill(id1)
        else 
        {
            
user_silentkill(id)
        }
        
        if ( 
iAnnounce )
            
client_print0print_chat"%s%s switched team to spectator"gszPrefixName )
    }

    return 
PLUGIN_HANDLED;



brian201049 01-02-2012 10:58

Re: button M go Spec button M again go CT For Ljserver
 
Quote:

Originally Posted by Erox902 (Post 1623257)
Try if this works the way you want it to.

It's a quite simple plugin, two cvars to use:
  • spec_announcement -Change this to 0 if you don't want to send a chatmsg information about which player did what.
  • spec_deathmessage -Change to 1 if you want the players that turns to spectator to show in the deathmsg. ( Up in the right corner by default )

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>

new const gszPrefix[] = "[CTR]"
new gCvarDeathMsg
new gCvarAnnouncement

public plugin_init()
{
    
register_plugin"ChooseteamReplacement""1.0""Rtk.Esc")
    
register_clcmd"chooseteam""replace_function" )
    
gCvarAnnouncement register_cvar"spec_announcement""1" )
    
gCvarDeathMsg register_cvar"spec_deathmessage""0" )
}

public 
chooseteam(id)
{
    static 
Name[34]
    
get_user_nameidNamecharsmax(Name) )
    
    new 
iAnnounce get_pcvar_numgCvarAnnouncement )
    
    if ( 
cs_get_user_team(id) != CS_TEAM_CT )
    {
        
cs_set_user_teamidCS_TEAM_CT )
        
ExecuteHamBHam_CS_RoundRespawnid )
        
        if ( 
iAnnounce )
            
client_print0print_chat"%s%s respawned as Ct again"gszPrefixName )
    }
    else
    {
        
cs_set_user_teamidCS_TEAM_SPECTATOR )
        
        if ( 
get_pcvar_numgCvarDeathMsg ) )
            
user_kill(id1)
        else 
        {
            
user_silentkill(id)
        }
        
        if ( 
iAnnounce )
            
client_print0print_chat"%s%s switched team to spectator"gszPrefixName )
    }



I am very surprised why your code will work.

Erox902 01-02-2012 11:01

Re: button M go Spec button M again go CT For Ljserver
 
Quote:

Originally Posted by brian201049 (Post 1623730)
I am very surprised why your code will work.

Oh now I saw what caused the error (Which almost made me lol) :mrgreen:
Edited the post and also tested it, works great now :)

sb123 01-04-2012 11:01

Re: button M go Spec button M again go CT For Ljserver
 
Quote:

Originally Posted by Erox902 (Post 1623257)
Try if this works the way you want it to.

It's a quite simple plugin, two cvars to use:
  • spec_announcement -Change this to 0 if you don't want to send a chatmsg information about which player did what.
  • spec_deathmessage -Change to 1 if you want the players that turns to spectator to show in the deathmsg. ( Up in the right corner by default )

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>

new const gszPrefix[] = "[CTR]"
new gCvarDeathMsg
new gCvarAnnouncement

public plugin_init()
{
    
register_plugin"ChooseteamReplacement""1.0""Rtk.Esc")
    
register_clcmd"chooseteam""replace_function" )
    
gCvarAnnouncement register_cvar"spec_announcement""1" )
    
gCvarDeathMsg register_cvar"spec_deathmessage""0" )
}

public 
replace_function(id)
{
    static 
Name[34]
    
get_user_nameidNamecharsmax(Name) )
    
    new 
iAnnounce get_pcvar_numgCvarAnnouncement )
    
    if ( 
cs_get_user_team(id) != CS_TEAM_CT )
    {
        
cs_set_user_teamidCS_TEAM_CT )
        
ExecuteHamBHam_CS_RoundRespawnid )
        
        if ( 
iAnnounce )
            
client_print0print_chat"%s%s respawned as Ct again"gszPrefixName )
    }
    else
    {
        
cs_set_user_teamidCS_TEAM_SPECTATOR )
        
        if ( 
get_pcvar_numgCvarDeathMsg ) )
            
user_kill(id1)
        else 
        {
            
user_silentkill(id)
        }
        
        if ( 
iAnnounce )
            
client_print0print_chat"%s%s switched team to spectator"gszPrefixName )
    }

    return 
PLUGIN_HANDLED;



work fine now..but have a little problem
1.when go to spec don't drop weapons
2,when go to spec remove dead body or hide body
3,some bad player will keep press M M M M M M
so i want add time limit (15seconds) ever time press M key

Erox902 01-05-2012 09:07

Re: button M go Spec button M again go CT For Ljserver
 
For the third request try this out.
PHP Code:

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

new const gszPrefix[] = "[CTR]"
new gCvarDeathMsg
new gCvarAnnouncement
new gCvarNextUse

new Float:gLastSwitch[33];

public 
plugin_init()
{
    
register_plugin"ChooseteamReplacement""1.0""Rtk.Esc")
    
register_clcmd"chooseteam""replace_function" )
    
gCvarAnnouncement register_cvar"spec_announcement""1" )
    
gCvarDeathMsg register_cvar"spec_deathmessage""0" )
    
gCvarNextUse register_cvar"spec_nextuse""15.0" )
}

public 
replace_function(id)
{
    static 
Name[34]
    
get_user_nameidNamecharsmax(Name) )
    
    new 
iAnnounce get_pcvar_numgCvarAnnouncement )
    
    new 
Float:flTime halflife_time();
    
    if ( 
flTime gLastSwitch[id] + get_pcvar_float(gCvarNextUse) )
        return 
PLUGIN_CONTINUE;
    
    if ( 
cs_get_user_team(id) != CS_TEAM_CT )
    {
        
cs_set_user_teamidCS_TEAM_CT )
        
ExecuteHamBHam_CS_RoundRespawnid )
        
        if ( 
iAnnounce )
            
client_print0print_chat"%s%s respawned as Ct again"gszPrefixName )
    }
    else
    {
        
cs_set_user_teamidCS_TEAM_SPECTATOR )
        
        if ( 
get_pcvar_numgCvarDeathMsg ) )
            
user_kill(id1)
        else 
        {
            
user_silentkill(id)
        }
        
        if ( 
iAnnounce )
            
client_print0print_chat"%s%s switched team to spectator"gszPrefixName )
    }
    
    
gLastSwitch[id] = flTime;
    return 
PLUGIN_HANDLED;


Removing dead bodies and weapons I'm not quite sure how to do only when this happends.

But since you have a lj server I see no need in keeping any bodies at all ( if that's okay ) you can use this.
PHP Code:

#include <amxmodx>

public plugin_init()
{
    
register_plugin"no dead bodies" "1.0" "kp_uparrow" )
    
set_msg_blockget_user_msgid"ClCorpse" ) , BLOCK_SET )


And same for weapons ( If you want them all to remove as soon as you drop them ) you can use this.
Remove Drop


All times are GMT -4. The time now is 20:59.

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