Raised This Month: $ Target: $400
 0% 

Solved Players List Menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 08-19-2022 , 19:41   Players List Menu
Reply With Quote #1

Hello Everyone,

I have started scripting and reading about scripts almost 3 months ago, I have read from here on how to create menu Here.

I got the basics a little bit.

I wanted to create a simple survivors bot list > for l4d2, but not necessary since the concept is the same. I read few scripts but they are either old or too complicated for me with more than 800 lines on simple function.

I made this one, which display the bots, but I cant target each of their names, I tried to select for example "Nick", but it showed me I selected the wrong bot. In fact, it only shows me the first survivor bot. I would really appreciate some helps here, thanks

PHP Code:
public void OnPluginStart()
{
    
RegConsoleCmd("sm_bot"Command_ShowBotsMenu"Show Bots Menu.");
}

public 
Action Command_ShowBotsMenu(int clientint args)
{
    
PrintToChat(client"Menu Opened");
    
Create_SurvivorsBotListMenu(client);
    return 
Plugin_Handled;
}

void Create_SurvivorsBotListMenu(int client)
{
    
Menu menu = new Menu(BotsListMENU_ACTIONS_ALL);
    
menu.SetTitle("Select A Bot:");
    
    for (
int i 1<= MaxClientsi++)
    {
        if (!
IsClientInGame(i) || !IsFakeClient(i) || !IsPlayerAlive(i) || GetClientTeam(i) != 2)
            continue;
        
        
char sID[32];
        
char sName[64];
        
        
GetClientName(isNamesizeof(sName));
        
Format(sIDsizeof(sID), "%N"i);
        
        
menu.AddItem(sIDsName);
    }
    
menu.Display(clientMENU_TIME_FOREVER);
}

public 
int BotsList(Menu menuMenuAction actionint param1int param2)
{
    switch(
action)
    {
        case 
MenuAction_Select:
        {
            
char sInfo[64];
            
menu.GetItem(param2sInfosizeof(sInfo));
            
            for (
int i 1<= MaxClientsi++)
            {
                if (!
IsClientInGame(i) || !IsFakeClient(i) || !IsPlayerAlive(i) || GetClientTeam(i) != && (StringToInt(sInfo) != i))
                    continue;
                    
                
PrintToChatAll("%N has selected %N."param1i);
                return;
            }
        }
        case 
MenuAction_End:
        {
            
delete menu;
        }
    }

__________________

Last edited by alasfourom; 08-20-2022 at 02:51.
alasfourom is offline
 



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


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