Raised This Month: $ Target: $400
 0% 

Picking a choice for a player in menu's


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-25-2011 , 06:44   Picking a choice for a player in menu's
Reply With Quote #1

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.
Diegorkable is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 07-25-2011 , 07:30   Re: Picking a choice for a player in menu's
Reply With Quote #2

Check team join management by Exolent[jNr] and see how he does it.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-25-2011 , 07:52   Re: Picking a choice for a player in menu's
Reply With Quote #3

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.

Last edited by Diegorkable; 07-25-2011 at 07:54.
Diegorkable is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-25-2011 , 08:15   Re: Picking a choice for a player in menu's
Reply With Quote #4

I tried using this: set_cvar_string("humans_join_team", "ct")
will it work?
Diegorkable is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 07-25-2011 , 08:55   Re: Picking a choice for a player in menu's
Reply With Quote #5

set_cvar_string("humans_join_team","ct") >> set_cvar_string("humans_join_team","CT")
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-25-2011 , 09:08   Re: Picking a choice for a player in menu's
Reply With Quote #6

Yes it works.
Diegorkable is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 07-25-2011 , 12:13   Re: Picking a choice for a player in menu's
Reply With Quote #7

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);

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Reply


Thread Tools
Display Modes

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 00:49.


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