Raised This Month: $ Target: $400
 0% 

Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
usaexelent
Senior Member
Join Date: Nov 2009
Location: Lithuania
Old 07-28-2011 , 07:02   Help
Reply With Quote #1

How can i make that people couldn't use change team menu. I tried this
from zombie plague, just edited it a bit
PHP Code:
//Forwards:
    
register_clcmd("jointeam""CTeam"); //Blocks actual team join
    
register_clcmd("chooseteam""CTeam"); //Blocks menu




public CTeam(id)
{
    
    
// Unless it's a spectator joining the game
    
if (cs_get_user_team(id) == CS_TEAM_SPECTATOR || cs_get_user_team(id) == CS_TEAM_UNASSIGNED)
        return 
PLUGIN_CONTINUE;
    
    
// Pressing 'M' (chooseteam) ingame should show the main menu instead
    
return PLUGIN_HANDLED;


Last edited by usaexelent; 07-28-2011 at 07:06.
usaexelent is offline
Send a message via Skype™ to usaexelent
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-28-2011 , 09:20   Re: Help
Reply With Quote #2

This plugin has all of the functionality you need:
http://forums.alliedmods.net/showthread.php?p=438587
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
usaexelent
Senior Member
Join Date: Nov 2009
Location: Lithuania
Old 07-28-2011 , 09:37   Re: Help
Reply With Quote #3

That code is very confusing i can't understand it :/
usaexelent is offline
Send a message via Skype™ to usaexelent
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-28-2011 , 09:53   Re: Help
Reply With Quote #4

Well I've pulled out what you need.
This will make players join Ct without showing any menu and it will disallow a player to bring up the menu.

PHP Code:
#include <amxmodx>

#define AUTO_TEAM_JOIN_DELAY 0.1

#define TEAM_SELECT_VGUI_MENU_ID 2

public plugin_init() 
{
    
register_message(get_user_msgid("ShowMenu"), "message_show_menu")
    
register_message(get_user_msgid("VGUIMenu"), "message_vgui_menu")
}

public 
message_show_menu(msgiddestid
{
    static 
team_select[] = "#Team_Select"
    
static menu_text_code[sizeof team_select]
    
get_msg_arg_string(4menu_text_codesizeof menu_text_code 1)
    if (!
equal(menu_text_codeteam_select))
        return 
PLUGIN_CONTINUE

    set_force_team_join_task
(idmsgid)

    return 
PLUGIN_HANDLED
}

public 
message_vgui_menu(msgiddestid) {
    if (
get_msg_arg_int(1) != TEAM_SELECT_VGUI_MENU_ID )
        return 
PLUGIN_CONTINUE

    set_force_team_join_task
(idmsgid)

    return 
PLUGIN_HANDLED
}

set_force_team_join_task(idmenu_msgid) {
    static 
param_menu_msgid[2]
    
param_menu_msgid[0] = menu_msgid
    set_task
(AUTO_TEAM_JOIN_DELAY"task_force_team_join"idparam_menu_msgidsizeof param_menu_msgid)
}

public 
task_force_team_join(menu_msgid[], id) {
    if (
get_user_team(id))
        return

    
force_team_join(idmenu_msgid[0], "2""1")
}

stock force_team_join(idmenu_msgid/* const */ team[] = "5"/* const */ class[] = "0") {
    static 
jointeam[] = "jointeam"
    
if (class[0] == '0') {
        
engclient_cmd(idjointeamteam)
        return
    }

    static 
msg_blockjoinclass[] = "joinclass"
    
msg_block get_msg_block(menu_msgid)
    
set_msg_block(menu_msgidBLOCK_SET)
    
engclient_cmd(idjointeamteam)
    
engclient_cmd(idjoinclass, class)
    
set_msg_block(menu_msgidmsg_block)

__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
usaexelent
Senior Member
Join Date: Nov 2009
Location: Lithuania
Old 07-28-2011 , 10:06   Re: Help
Reply With Quote #5

But i need that at first they could use the menu, when they are spectators or unnasigned.And when they are in team T or CT the menu wouldn't work
usaexelent is offline
Send a message via Skype™ to usaexelent
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-28-2011 , 10:33   Re: Help
Reply With Quote #6

I've added a simple team check.

PHP Code:
#include <amxmodx>

#define AUTO_TEAM_JOIN_DELAY 0.1

#define TEAM_SELECT_VGUI_MENU_ID 2

public plugin_init() 
{
    
register_message(get_user_msgid("ShowMenu"), "message_show_menu")
    
register_message(get_user_msgid("VGUIMenu"), "message_vgui_menu")
}

public 
message_show_menu(msgiddestid
{
    static 
team_select[] = "#Team_Select"
    
static menu_text_code[sizeof team_select]
    
get_msg_arg_string(4menu_text_codesizeof menu_text_code 1)
    if (!
equal(menu_text_codeteam_select))
        return 
PLUGIN_CONTINUE

    set_force_team_join_task
(idmsgid)

    return 
PLUGIN_HANDLED
}

public 
message_vgui_menu(msgiddestid
{
    if( 
get_user_teamid ) != && get_user_teamid ) != )
    return 
PLUGIN_CONTINUE;
    
    if (
get_msg_arg_int(1) != TEAM_SELECT_VGUI_MENU_ID )
        return 
PLUGIN_CONTINUE

    set_force_team_join_task
(idmsgid)

    return 
PLUGIN_HANDLED
}

set_force_team_join_task(idmenu_msgid) {
    static 
param_menu_msgid[2]
    
param_menu_msgid[0] = menu_msgid
    set_task
(AUTO_TEAM_JOIN_DELAY"task_force_team_join"idparam_menu_msgidsizeof param_menu_msgid)
}

public 
task_force_team_join(menu_msgid[], id) {
    if (
get_user_team(id))
        return

    
force_team_join(idmenu_msgid[0], "1""1")
}

stock force_team_join(idmenu_msgid/* const */ team[] = "5"/* const */ class[] = "0") {
    static 
jointeam[] = "jointeam"
    
if (class[0] == '0') {
        
engclient_cmd(idjointeamteam)
        return
    }

    static 
msg_blockjoinclass[] = "joinclass"
    
msg_block get_msg_block(menu_msgid)
    
set_msg_block(menu_msgidBLOCK_SET)
    
engclient_cmd(idjointeamteam)
    
engclient_cmd(idjoinclass, class)
    
set_msg_block(menu_msgidmsg_block)

__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
usaexelent
Senior Member
Join Date: Nov 2009
Location: Lithuania
Old 07-28-2011 , 12:35   Re: Help
Reply With Quote #7

I can still access change team menu :/

This is the code that i use:

PHP Code:

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

// Define player models 

#define CMDL "models/player/CMDL/CMDL.mdl" 

// Define T player models 

#define CMDLT "models/player/CMDL/CMDLT.mdl" 

#define fm_cs_set_user_nobuy(%1)    set_pdata_int(%1, 235, get_pdata_int(%1, 235) & ~(1<<0) )

#define AUTO_TEAM_JOIN_DELAY 0.1

#define TEAM_SELECT_VGUI_MENU_ID 2

// Create arrays that will hold location to weapon models 

new VIEW_MODELKNIFE[]    = "models/CRYSMOD/c_v_knife.mdl"   
new VIEW_MODELAUG[]    = "models/CRYSMOD/c_v_aug.mdl"  
new VIEW_MODELUSP[]    = "models/CRYSMOD/c_v_usp.mdl"  
new PLAYER_MODELAUG[]    = "models/CRYSMOD/c_p_aug.mdl"   

new MsgSync

new Crysis// Holder for Crisis player id 
new iRand// The random player id 

public plugin_cfg()
{
    
register_message(get_user_msgid("StatusIcon") , "Message_StatusIcon")
}

// Precache models and sounds for alter use 

public plugin_precache()  
{  
    
console_cmd(0"mp_autoteambalance 0")
    
MsgSync CreateHudSyncObj();
    
precache_model(CMDL
    
precache_model(CMDLT
    
precache_model(VIEW_MODELKNIFE);  
    
precache_model(VIEW_MODELAUG);   
    
precache_model(VIEW_MODELUSP);   
    
precache_model(PLAYER_MODELAUG); 
    
precache_sound("boost.wav"); 



public 
plugin_init()  

    
register_plugin("Someting","0.1","usaexelent"); // Register plugin info 
     
     
    
register_event"CurWeapon""Event_CurWeapon""be""1=1" ); // Register curweapon  
    
register_event("HLTV""GetCrysis""a""1=0""2=0")  //Register new round 
    
RegisterHam(Ham_Spawn"player""Player_Spawn_Post"1); //Register spawn 
    
RegisterHam(Ham_Killed"player""Player_Death"1//0 = before death 1 = after
    
register_message(get_user_msgid("ShowMenu"), "message_show_menu")
    
register_message(get_user_msgid("VGUIMenu"), "message_vgui_menu")


}  


public 
Event_CurWeaponid )  
{  
if(  
Crysis == id && is_user_aliveid )  )  
     { 
     

    switch( 
read_data(2) )  
    {  
        case 
CSW_KNIFE:  
        {  
            
set_pevidpev_viewmodel2VIEW_MODELKNIFE); // set models  
            
set_user_rendering(idkRenderFxGlowShell211kRenderTransTexture50// set visibility  
            
set_user_maxspeed(id, -1
        }  
        case 
CSW_USP:  
        {  
            
set_pevidpev_viewmodel2VIEW_MODELUSP); // set models 
            
set_user_rendering(id
            
set_user_maxspeed(id, -1
        }  
        case 
CSW_AUG:  
        {  
            
set_pevidpev_viewmodel2VIEW_MODELAUG); // set models  
            
set_pevidpev_weaponmodel2PLAYER_MODELAUG ); // set models 
            
set_user_rendering(id
            
set_user_maxspeed(id, -1
        }  
        default:  
    {  
    
set_user_rendering(id);   
    }  
     } 
    } 
}  

public 
GetCrysis( )  
{
    
Crysis 0
    
new iPlayers32 ], iNum;  
    
get_playersiPlayersiNum"h" );  
    
iRand iPlayersrandomiNum ) ]; // Get random player  
    
Crysis iRand;  // Set the randplayer to be crisis :) 
    
client_print(iRandprint_chat"You are Crisis now!");
            
cs_set_user_team(iRandCS_TEAM_CT)
    for(new 
i=1;iNum;i++)
    {
        if(
iRand != i)
    
cs_set_user_team(iCS_TEAM_T)
    }

}  


public 
Player_Spawn_Post(id
{
cs_reset_user_model(id)
    if(
Crysis == id)
    {
            
set_user_health(id, ( get_user_health(id)+35 ) );
            
cs_set_user_armor(id200CS_ARMOR_VESTHELM);
            
set_user_gravity(id,Float:0.9);
            
set_user_maxspeed(id, -1);
            
strip_user_weapons(id);
            
give_item(id,"item_longjump");
            
give_item(id,"weapon_aug");
            
give_item(id,"weapon_knife");
            
give_item(id,"weapon_usp");
            
cs_set_user_bpammo(idCSW_AUG200);
            
cs_set_user_bpammo(idCSW_USP75);
            
client_cmd(id"spk ^"sound/boost.wav^"");
            if (
cs_get_user_team(id) == CS_TEAM_CT) { 
            
cs_set_user_model(id"CMDL")
            }
    }
set_task(0.1"ShowCrisis"id__"b")



public 
player_death(idkillergib// callback for Ham_Killed hook 

    if(
Crysis == id// if "crysis" died, clear his flag 
    

        
Crysis 

    



public 
client_disconnect(id

    if(
Crysis == id
    { 
    
GetCrysis() 
    } 
}


public 
Message_StatusIcon(iMsgIdMSG_DESTid)
{
    static 
szIcon[5]
    
get_msg_arg_string(2szIcon4)
    if( 
szIcon[0] == 'b' && szIcon[2] == 'y' && szIcon[3] == 'z' )
    {
        if( 
get_msg_arg_int(1) && cs_get_user_team(id) == 2)
        {
            
fm_cs_set_user_nobuy(id)
            return 
PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_CONTINUE
}


public 
ShowCrisis(id)
{
    if(
Crysis == 0)
    {
    
set_hudmessage(25500, -1.00.0706.012.0)
    
ShowSyncHudMsg(idMsgSync"Crisis dar nepasirinktas")    
    }
    else
    {
    new 
imname[32];
    
get_user_name(Crysis,imname,31);
    
set_hudmessage(25500, -1.00.0706.012.0)
    
ShowSyncHudMsg(idMsgSync"Crisis yra %s"imname)
    }
}

public 
message_show_menu(msgiddestid
{
    static 
team_select[] = "#Team_Select"
    
static menu_text_code[sizeof team_select]
    
get_msg_arg_string(4menu_text_codesizeof menu_text_code 1)
    if (!
equal(menu_text_codeteam_select))
        return 
PLUGIN_CONTINUE

    set_force_team_join_task
(idmsgid)

    return 
PLUGIN_HANDLED
}

public 
message_vgui_menu(msgiddestid
{
    if( 
get_user_teamid ) != && get_user_teamid ) != )
    return 
PLUGIN_CONTINUE;
    
    if (
get_msg_arg_int(1) != TEAM_SELECT_VGUI_MENU_ID )
        return 
PLUGIN_CONTINUE

    set_force_team_join_task
(idmsgid)

    return 
PLUGIN_HANDLED
}

set_force_team_join_task(idmenu_msgid) {
    static 
param_menu_msgid[2]
    
param_menu_msgid[0] = menu_msgid
    set_task
(AUTO_TEAM_JOIN_DELAY"task_force_team_join"idparam_menu_msgidsizeof param_menu_msgid)
}

public 
task_force_team_join(menu_msgid[], id) {
    if (
get_user_team(id))
        return

    
force_team_join(idmenu_msgid[0], "1""1")
}

stock force_team_join(idmenu_msgid/* const */ team[] = "5"/* const */ class[] = "0") {
    static 
jointeam[] = "jointeam"
    
if (class[0] == '0') {
        
engclient_cmd(idjointeamteam)
        return
    }

    static 
msg_blockjoinclass[] = "joinclass"
    
msg_block get_msg_block(menu_msgid)
    
set_msg_block(menu_msgidBLOCK_SET)
    
engclient_cmd(idjointeamteam)
    
engclient_cmd(idjoinclass, class)
    
set_msg_block(menu_msgidmsg_block)

all i want to do is that when you enter the server you can choose a team and later the command would be blocked

Last edited by usaexelent; 07-28-2011 at 12:40.
usaexelent is offline
Send a message via Skype™ to usaexelent
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 01:06.


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