Raised This Month: $ Target: $400
 0% 

Menu problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nano2e
SourceMod Donor
Join Date: Apr 2012
Location: Australia
Old 10-03-2012 , 06:00   Menu problem
Reply With Quote #1

im working on a menu that allows admins to do certain things to clients, im just testing out kick for now. atm i cant kick client when i choose the kick option, idk how to pass the target variable on when kick is chosen

heres my code:

PHP Code:

public KickPrint(clienttarget)
{    
    new 
Handle:Panel CreatePanel(GetMenuStyleHandle(MenuStyle_Radio));
    
decl String:targetname[MAX_NAME_LENGTH], String:text[64], String:steamid[32];
    
    
GetClientName(targettargetnamesizeof(targetname));
    
GetClientAuthString(targetsteamidsizeof(steamid));
    
    
Format(textsizeof(text), "Myserver - %s : %s"targetnamesteamid)
    
    
SetPanelTitle(Paneltext)
    
DrawPanelItem(Panel" "ITEMDRAW_SPACER|ITEMDRAW_RAWLINE)    
    
Format(textsizeof(text), "Kick")
    
DrawPanelItem(Paneltext)
    
Format(textsizeof(text), "%t""Previous")
    
DrawPanelItem(Paneltext)
    
Format(textsizeof(text), "%t""Next")
    
DrawPanelItem(Paneltext)
    
Format(textsizeof(text), "%t""Exit")
    
DrawPanelItem(Paneltext)

    
SendPanelToClient(PanelclientKickMenu20)

    
CloseHandle(Panel)

    
g_current[client] = target
}

public 
KickMenu(Handle:menuMenuAction:actionparam1param2)
{
    new 
next

    
if (action == MenuAction_Select)
    {
        if (
param2 == 1//kick
        
{
            
//need to kick them
        
}
        
        else if (
param2 == 2//Previous
        
{
            
next FindPrevPlayer(g_current[param1])
            if (
next != -1)
                
KickPrint(param1next)
            else
            {
            }

        }
        else if (
param2 == 3//Next
        
{
            
next=FindNextPlayer(g_current[param1])
            if (
next != -1)
                
KickPrint(param1next)
            else
            {
            }
        }
    }
}

stock FindNextPlayer(player)
{
    new 
temp player

    
do
    {
        
temp++
        if (
temp GetMaxClients())
            
temp 1

        
if (temp == player)
            return -
1
    
}
    while (!(
IsClientInGame(temp) && !IsFakeClient(temp)))

    return 
temp
}

stock FindPrevPlayer(player)
{
    new 
temp player

    
do
    {
        
temp--
        if (
temp 1)
            
temp GetMaxClients()

        if (
temp == player)
            return -
1
    
}
    while (!(
IsClientInGame(temp) && !IsFakeClient(temp)))

    return 
temp

Nano2e is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 10-03-2012 , 09:50   Re: Menu problem
Reply With Quote #2

Why dont you make a loop of players (like the regular kick menu does) and then which ever one you pick will kick them.
Mitchell is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-03-2012 , 09:52   Re: Menu problem
Reply With Quote #3

...are you creating whole new menu-system for admins ?
Is there reason, why you can't use SM base admin menu ?
I just asking
__________________
Do not Private Message @me
Bacardi is offline
Nano2e
SourceMod Donor
Join Date: Apr 2012
Location: Australia
Old 10-03-2012 , 09:58   Re: Menu problem
Reply With Quote #4

i wouldnt know how to, and im integrating this menu thing into a custom comp tf2 plugin
Nano2e is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-03-2012 , 14:19   Re: Menu problem
Reply With Quote #5

I highly recommend using CreateMenu or CreateMenuEx instead of CreatePanel. Or even using TopMenus instead, although I don't really have experience using TopMenus.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Nano2e
SourceMod Donor
Join Date: Apr 2012
Location: Australia
Old 10-03-2012 , 18:54   Re: Menu problem
Reply With Quote #6

ill try my best with it
Nano2e 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 09:01.


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