Raised This Month: $32 Target: $400
 8% 

Solved [CS:GO] Help in menu Show Players in server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
leandro442
Member
Join Date: Sep 2013
Location: Portugal
Old 01-24-2021 , 16:10   [CS:GO] Help in menu Show Players in server
Reply With Quote #1

Hello ! I wanted help on the menu that I'm trying to create that aims when I type / stealplayer open the menu with list of players on the server to play and when I click on the player he writes by playing / steal (and name of the player I chose)

PHP Code:
public void roubarmenushow(int client)
{
    
char name[MAX_NAME_LENGTH];
    
char id[32];
    
char buffer[PLATFORM_MAX_PATH];
    
//char balance[64];
     
Menu menu CreateMenu(listajogadoresparaorubar);
     
//String:name[MAX_NAME_LENGTH+1], String:id[32], String:buffer[PLATFORM_MAX_PATH+1], String:balance[64];
    //new Handle:menu = CreateMenu(listajogadoresparaorubar);
     
Format(buffersizeof(buffer), "Choose Player"client);
    
SetMenuTitle(menu"Taberna robar:");
        
        
        
/*for(int i=1; i <= MaxClients; i++)
        {
          if(IsClientInGame(i))
             {  
            //GetBankMoney(i, balance, sizeof(balance));
            GetClientName(i, name, sizeof(name));
            IntToString(i, id, sizeof(id));
            //Format(buffer, sizeof(buffer), "Choose Player", client);
            Format(buffer, sizeof(buffer), "Choose Player", client);
            IntToString(GetClientUserId(i), id, sizeof(id));
            //IntToString(i, balance, sizeof(balance));
            AddMenuItem(i, id, name);
            }
        }*/
        //SetMenuExitButton(menu,true);
        //DisplayMenu(menu, client, MENU_TIME_FOREVER);
    

    
if (LastMenuAction[client] >= 100)
     {
        
//GetBankMoney(client, balance, sizeof(balance));
        
GetClientName(clientnamesizeof(name));
        
//IntToMoney( GetBankMoney(client) , balance, sizeof(balance));
        
IntToString(clientidsizeof(id));
        
//IntToString(client, balance, sizeof(balance));
        
AddMenuItem(menuidname);
    }
    if (
GetPlayerCount() > 1)
    {
        for(
int i=1<= MaxClientsi++)
        {
          if(
IsClientInGame(i))
             {  
            
//GetBankMoney(i, balance, sizeof(balance));
            
GetClientName(inamesizeof(name));
            
IntToString(iidsizeof(id));
            
//Format(buffer, sizeof(buffer), "Choose Player", client);
            
Format(buffersizeof(buffer), "Choose Player"client);
            
//IntToString(GetClientUserId(i), id, sizeof(id));
            //IntToString(i, balance, sizeof(balance));
            
AddMenuItem(iidname);
            }
        }
        
    }
    else if (
LastMenuAction[client] >= 100)
    {
        
PrintToChat(client"Nenhum jogador online");
    }
    else
    {
        
PrintToChat(client"Nenhum jogador online");
        
CloseHandle(menu);
        return;
    }
    
SetMenuExitBackButton(menutrue);
    
DisplayMenu(menuclient20);
    
//menu.ExitButton = true;
    //menu.Display(client, MENU_TIME_FOREVER);

}
/////////////    
public int listajogadoresparaorubar(Menu menuMenuAction actionint clientint param2)
{
    if (
action == MenuAction_Select)
    {
        
//char buffer[32];
        
char info[32];
        
bool found GetMenuItem(menuparam2infosizeof(info));
        
        
FakeClientCommandEx(client"say /steal %s"info);
        
/*ServerCommand("changelevel %s", info);
 
        /* Get item info */
       // bool found = menu.GetItem(param2, info, sizeof(info));
 
        /* Tell the client */
        //PrintToConsole(param1, "You selected item: %d (found? %d info: %s)", param2, found, info);
 
        /* Change the map */
        //ServerCommand("changelevel %s", info);
        //new String:info[32];
        /*new bool:found = GetMenuItem(menu, param2, info, sizeof(info));
        if (!found)
            return;

        TargetClientMenu[client] = StringToInt(info);

        if (!IsValidClient(TargetClientMenu[client]))
        {
            PrintToChat(client, "%t", "False Target", plugin_name);
            CloseHandle(menu);
            return;
        }*/
    
}
}

public 
Action GetPlayerCount()
{
int clients 0;
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsValidClient(i))
            
clients++;
    }
    return 
clients;


Last edited by leandro442; 02-17-2021 at 19:32.
leandro442 is offline
Lawyn
Junior Member
Join Date: Jul 2020
Old 02-17-2021 , 05:47   Re: [CS:GO] Help in menu Show Players in server
Reply With Quote #2

Try to use this

PHP Code:
void ShowTargetMenu(int client)
{
    
Menu fdmenu = new Menu(meniulnever);
    
fdmenu.SetTitle("MENU TITLE\n ");
    
    
char szName[MAX_NAME_LENGTH], szMenuIndex[10];
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i))
        {
            
GetClientName(iszNamesizeof(szName));
            
Format(szMenuIndexsizeof(szMenuIndex), "%N"i);
            
fdmenu.AddItem(szMenuIndexszName);
        }
    }
    
    
fdmenu.ExitBackButton true;
    
fdmenu.Display(clientMENU_TIME_FOREVER);
}

public 
meniulnever(Menu:fdmenuMenuAction:actionclientitemNum)
{
    if (
action == MenuAction_Cancel && itemNum == MenuCancel_ExitBack || action == MenuAction_End)
    {
        
CloseHandle(fdmenu)
    } 
    else if (
action == MenuAction_Select
    {
        
char szInfo[10];
        
fdmenu.GetItem(itemNumszInfosizeof(szInfo));
        
int target FindTarget(clientszInfofalsefalse);
        
// Succes action
    
}

__________________

Last edited by Lawyn; 02-17-2021 at 05:48.
Lawyn is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-17-2021 , 10:03   Re: [CS:GO] Help in menu Show Players in server
Reply With Quote #3

if possible, don't use player names when execute command.
Use player userid instead. (It depends also, does userid work on that "steal" plugin)

Last edited by Bacardi; 02-17-2021 at 10:04.
Bacardi is offline
leandro442
Member
Join Date: Sep 2013
Location: Portugal
Old 02-17-2021 , 19:31   Re: [CS:GO] Help in menu Show Players in server
Reply With Quote #4

I fix it a i use other way with fakeclient but thx
leandro442 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 01:22.


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