Raised This Month: $ Target: $400
 0% 

Menu for Spectator


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RICHIERICH
BANNED
Join Date: Oct 2009
Location: RICH HOUSE
Old 10-23-2009 , 10:19   Menu for Spectator
Reply With Quote #1

how to built menu ?? when all players r in spec and admin say /selecteams

than menu is visible to admin for choosing players to specific teams

RICHIE RICH should go in
1. T
2. CT

so admin have to choose 1 or 2 & than that players goes to that specified team,,,,,

Last edited by RICHIERICH; 10-23-2009 at 16:08.
RICHIERICH is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-23-2009 , 11:40   Re: Menu for Spectator
Reply With Quote #2

Uncompiled, untested:

PHP Code:
#include <amxmodx>
#include <cstrike>

public plugin_init()
{
    
register_plugin"Spec Menu""1.0""Hawk552" )
    
    
// Add admin checking.
    
register_clcmd"amx_specmenu""CmdSpecMenu" )
}

public 
CmdSpecMenuid )
{
    new 
players[32], playersNumplayer
    get_players
playersplayersNum )
    
    for ( new 
iplayersNumi++ )
    {
        if ( 
cs_get_user_teamplayer players[i] ) == CS_TEAM_SPECTATOR )
        {
            static 
menuTitle[64], name[33], idStr[3]
            
get_user_nameplayername32 )
            
num_to_strplayeridStr)
            
            
formatexmenuTitle63"Which team should %s be on?"name )
            
            new 
menu menu_createmenuTitle"MenuHandle" )
            
menu_additemmenu"Terrorist"idStr )
            
menu_additemmenu"Counter-Terrorist" )
            
            
menu_displayidmenu )
            
            break
        }
    }
    
    return 
PLUGIN_HANDLED
}

public 
MenuHandleidmenuitem )
{
    if ( 
item == MENU_EXIT )
    {
        
menu_destroymenu )
        return 
PLUGIN_HANDLED
    
}
    
    static 
garbageidStr[3]
    
menu_item_getinfomenu0garbageidStr2__garbage )
    
menu_destroymenu )
    
    new 
player str_to_numidStr )
    
    new 
teamStr[2]
    
teamStr[0] = item '2' '1'
    
    
// In case they left before the menu option was chosen.
    
if ( is_user_connectedplayer ) )
    {
        
engclient_cmdplayer"jointeam"teamStr )
        
// Adjust this yourself later. It's not important for functionality.
        
engclient_cmdplayer"joinclass""1" )
        
        
// If they're still spectators.
        
if ( cs_get_user_teamplayer ) == CS_TEAM_SPECTATOR )
            
// Use a crappier method that always works.
            
cs_set_user_teamplayeritem CS_TEAM_CT CS_TEAM_T )
    }
    
    
CmdSpecMenuid )
    
    return 
PLUGIN_HANDLED

You'll need a ton of extra checks that I neglected to make it faster to write. I only added ones that I figured you would probably miss.
__________________

Last edited by Hawk552; 10-23-2009 at 12:00.
Hawk552 is offline
Send a message via AIM to Hawk552
RICHIERICH
BANNED
Join Date: Oct 2009
Location: RICH HOUSE
Old 10-23-2009 , 14:56   Re: Menu for Spectator
Reply With Quote #3

thanks for the code +karma will check and tell the result..
RICHIERICH is offline
RICHIERICH
BANNED
Join Date: Oct 2009
Location: RICH HOUSE
Old 10-23-2009 , 15:35   Re: Menu for Spectator
Reply With Quote #4

ERROR on line 19 Possible unintended assigment
RICHIERICH is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-23-2009 , 15:38   Re: Menu for Spectator
Reply With Quote #5

Quote:
Originally Posted by RICHIERICH View Post
ERROR on line 19 Possible unintended assigment
That's actually just a warning, and would have been caught if I had tried compiling it before posting it. The plugin will work anyway, but to fix it, change that line from:

PHP Code:
        if ( cs_get_user_teamplayer players[i] ) == CS_TEAM_SPECTATOR 
...to...

PHP Code:
        if ( cs_get_user_team( ( player players[i] ) ) == CS_TEAM_SPECTATOR 
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
izzle
Senior Member
Join Date: Aug 2009
Old 10-23-2009 , 15:40   Re: Menu for Spectator
Reply With Quote #6

Quote:
Originally Posted by RICHIERICH View Post
ERROR on line 19 Possible unintended assigment
Quote:
Warning: Possibly unintended assignment on line 19
theres no errors
izzle is offline
Old 10-23-2009, 15:46
RICHIERICH
This message has been deleted by RICHIERICH. Reason: srry
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-23-2009 , 15:47   Re: Menu for Spectator
Reply With Quote #8

What are you trying to merge?
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
RICHIERICH
BANNED
Join Date: Oct 2009
Location: RICH HOUSE
Old 10-23-2009 , 15:51   Re: Menu for Spectator
Reply With Quote #9

amx_spec - all players to spec
amx_specmenu - menu for selection

need to merge this 2 codes..

-----------------------------
ur code worked for me ...but when team selection is done and whn players spawn they get menu of selection models.can u handle that by showing that menu b4

RICHIERICH is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-23-2009 , 16:02   Re: Menu for Spectator
Reply With Quote #10

Quote:
Originally Posted by RICHIERICH View Post
amx_spec - all players to spec
amx_specmenu - menu for selection

need to merge this 2 codes..

-----------------------------


No. When you come to this forum, you should have a basic level of understanding. The people here will only guide you through more complex concepts.

Quote:
Originally Posted by RICHIERICH View Post
ur code worked for me ...but when team selection is done and whn players spawn they get menu of selection models.can u handle that by showing that menu b4
It shouldn't be doing that. Explain in more detail what is happening.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
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 17:43.


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