AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Picking a choice for a player in menu's (https://forums.alliedmods.net/showthread.php?t=162972)

Diegorkable 07-25-2011 06:44

Picking a choice for a player in menu's
 
Is there any way I can pick a choice for a player through a plugin? Like, if I detect that he has reached the menu ID of 'chooseteam' I'll pick 1 FOR him, without him even needing to press it.

drekes 07-25-2011 07:30

Re: Picking a choice for a player in menu's
 
Check team join management by Exolent[jNr] and see how he does it.

Diegorkable 07-25-2011 07:52

Re: Picking a choice for a player in menu's
 
I looked at it, and I don't understand alot of things since I don't know these functions, could you please help me and please post the part of code where he forces them to pick 1 then?

I believe that's it:

PHP Code:

stock handle_join(idiMsgidiTeam)
{
    new 
iMsgBlock get_msg_block(iMsgid);
    
set_msg_block(iMsgidBLOCK_SET);
    
    
engclient_cmd(id"jointeam"g_sTeamNums[iTeam]);
    
    new 
iClass get_team_class(iTeam);
    if(
<= iClass <= 4)
    {
        
engclient_cmd(id"joinclass"g_sClassNums[iClass 1]);
    }
    
set_msg_block(iMsgidiMsgBlock);


But I can't understand anything from it, therefore I don't know how to apply it to my code.

Diegorkable 07-25-2011 08:15

Re: Picking a choice for a player in menu's
 
I tried using this: set_cvar_string("humans_join_team", "ct")
will it work?

^SmileY 07-25-2011 08:55

Re: Picking a choice for a player in menu's
 
set_cvar_string("humans_join_team","ct") >> set_cvar_string("humans_join_team","CT")

Diegorkable 07-25-2011 09:08

Re: Picking a choice for a player in menu's
 
Yes it works.

drekes 07-25-2011 12:13

Re: Picking a choice for a player in menu's
 
Explanation of Exolent's code:

PHP Code:

stock handle_join(idiMsgidiTeam)
{
    
// Checks if the message is already blocked.
    
new iMsgBlock get_msg_block(iMsgid);
    
    
// Block it.
    
set_msg_block(iMsgidBLOCK_SET);
    
    
// Make him join the wanted team.
    
engclient_cmd(id"jointeam"g_sTeamNums[iTeam]);
    
    
// Need that function code to know what this does.
    
new iClass get_team_class(iTeam);
    
    
// if the class is between 1 & 4
    
if(<= iClass <= 4)
    {
        
// Make him choose a class
        
engclient_cmd(id"joinclass"g_sClassNums[iClass 1]);
    }
    
    
// Set it back to it's original block state.
    
set_msg_block(iMsgidiMsgBlock);




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

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