Raised This Month: $ Target: $400
 0% 

How to get player in menu_handler?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dkmuniz
Senior Member
Join Date: Jun 2013
Old 01-17-2015 , 11:16   How to get player in menu_handler?
Reply With Quote #1

Well i added players in menu but i want to selected player give render color, but no works, anyone can help ?

PHP Code:
#include <sourcemod>
#include <adminmenu> 
#include <cstrike>
#include <csgocolors>

public OnPluginStart() 

    
RegConsoleCmd("sm_freeday"Menu); 


public 
Action:Menu(clientargs
{
    if(
GetClientTeam(client) == CS_TEAM_CT
    {
            
DID(client);
    }
    else 
    {
        
PrintToChat(client"Not Ct");
    }
}

public 
Action:DID(clientId)
{
    new 
Handle:menu CreateMenu(DIDMenuHandler);
    
SetMenuTitle(menu"Menu Freeday para prisioneiro");
    
    for (new 
1<= MaxClientsi++)
    {
        if (!
IsClientInGame(i)) continue;

        
decl String:sID[4], String:sName[16];

        
GetClientName(isNamesizeof(sName));
        
Format(sIDsizeof(sID), "%d"i);

        
AddMenuItem(menusIDsName);
    }  
    
DisplayMenu(menuclientId15);
    
    return 
Plugin_Handled;
}

public 
DIDMenuHandler(Handle:menuMenuAction:actionparam1param2)
{
    new 
String:sInfo[32];
    
GetMenuItem(menuparam2sInfosizeof(sInfo));
    if (
action == MenuAction_Select)
   {
        
//HERE COLOR TO SELECTED PLAYER
    
}

    if (
action == MenuAction_End)
    {
        
CloseHandle(menu)
    }

Dkmuniz is offline
Dkmuniz
Senior Member
Join Date: Jun 2013
Old 01-17-2015 , 12:01   Re: How to get player in menu_handler?
Reply With Quote #2

No answer?

Last edited by Dkmuniz; 01-17-2015 at 12:01.
Dkmuniz is offline
Starbish
AlliedModders Donor
Join Date: Oct 2011
Location: South Korea
Old 01-17-2015 , 12:02   Re: How to get player in menu_handler?
Reply With Quote #3

param1 is client index.
__________________
Starbish is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-17-2015 , 12:13   Re: How to get player in menu_handler?
Reply With Quote #4

PHP Code:
#include <adminmenu>
#include <menus>

public OnPluginStart()
{
    
RegConsoleCmd("sm_freeday"freeday);
}

public 
Action:freeday(clientargs)
{
    if(
client != && IsClientInGame(client) && GetClientTeam(client) == 3)
    {
        
OpenMenu(client);
    }
    return 
Plugin_Handled;
}

OpenMenu(client)
{
    new 
Handle:menu CreateMenu(menuhandler);
    
SetMenuTitle(menu"Title");

    
AddTargetsToMenu(menu0truetrue);
    
DisplayMenu(menuclientMENU_TIME_FOREVER);
}

public 
menuhandler(Handle:menuMenuAction:actionparam1param2)
{
    switch(
action)
    {
        case 
MenuAction_End:
        {
            
CloseHandle(menu);
        }
        case 
MenuAction_Select:
        {
            new 
String:info[MAX_NAME_LENGTH];
            
GetMenuItem(menuparam2infosizeof(info));
            new 
target GetClientOfUserId(StringToInt(info));

            if(
target == || !IsClientInGame(target))
            {
                
GetMenuItem(menuparam2info0_infosizeof(info));
                
PrintToChat(param1"Player %s not in game."info)
            }
            else
            {
                
PrintToChat(param1"You %N choosed %N"param1target);
            }
        }
    }

__________________
Do not Private Message @me
Bacardi is offline
Dkmuniz
Senior Member
Join Date: Jun 2013
Old 01-17-2015 , 12:39   Re: How to get player in menu_handler?
Reply With Quote #5

Quote:
Originally Posted by Bacardi View Post
PHP Code:
#include <adminmenu>
#include <menus>

public OnPluginStart()
{
    
RegConsoleCmd("sm_freeday"freeday);
}

public 
Action:freeday(clientargs)
{
    if(
client != && IsClientInGame(client) && GetClientTeam(client) == 3)
    {
        
OpenMenu(client);
    }
    return 
Plugin_Handled;
}

OpenMenu(client)
{
    new 
Handle:menu CreateMenu(menuhandler);
    
SetMenuTitle(menu"Title");

    
AddTargetsToMenu(menu0truetrue);
    
DisplayMenu(menuclientMENU_TIME_FOREVER);
}

public 
menuhandler(Handle:menuMenuAction:actionparam1param2)
{
    switch(
action)
    {
        case 
MenuAction_End:
        {
            
CloseHandle(menu);
        }
        case 
MenuAction_Select:
        {
            new 
String:info[MAX_NAME_LENGTH];
            
GetMenuItem(menuparam2infosizeof(info));
            new 
target GetClientOfUserId(StringToInt(info));

            if(
target == || !IsClientInGame(target))
            {
                
GetMenuItem(menuparam2info0_infosizeof(info));
                
PrintToChat(param1"Player %s not in game."info)
            }
            else
            {
                
PrintToChat(param1"You %N choosed %N"param1target);
            }
        }
    }

But my plugin add only terrorist in menu!
Dkmuniz is offline
Dkmuniz
Senior Member
Join Date: Jun 2013
Old 01-17-2015 , 12:39   Re: How to get player in menu_handler?
Reply With Quote #6

Quote:
Originally Posted by Starbish View Post
param1 is client index.
I tried param1, but no worked
Dkmuniz is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-17-2015 , 12:54   Re: How to get player in menu_handler?
Reply With Quote #7

Quote:
Originally Posted by Dkmuniz View Post
But my plugin add only terrorist in menu!
well that what you posted not going to do that.

Spoiler
__________________
Do not Private Message @me
Bacardi is offline
Dkmuniz
Senior Member
Join Date: Jun 2013
Old 01-17-2015 , 13:02   Re: How to get player in menu_handler?
Reply With Quote #8

Quote:
Originally Posted by Bacardi View Post
well that what you posted not going to do that.

Spoiler
Works nice, ty <3
Dkmuniz is offline
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 03:32.


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