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

[TF2] Simple Donator Perk Menu?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KiRRA
Senior Member
Join Date: Nov 2012
Old 12-29-2012 , 13:55   [TF2] Simple Donator Perk Menu?
Reply With Quote #1

G'day everyone.

I have been reading over multiple posts trying to figure out how to do this but haven't really had any luck.

I am looking to make a simple pop up menu that will list a few commands that players can toggle as a simple donator perk. The commands do not have any true value so repeating the command again should toggle it on/off. One command happens to be a command to open up the menu of a separate plugin (hopefully that is possible to add in and doesn't cause conflicts).

Here are the commands that I would like to incorproate, as well as the links to thier respectful plugin threads.

sm_ccc
https://forums.alliedmods.net/showthread.php?t=199233

sm_robot
https://forums.alliedmods.net/showth...ight=tf2+robot

I was hoping to get the menu to be like this if this is possible: maybe accessed by the command (!donator) seeing as how that's what the old plugins used to use and might be easier to remember.

Donator Menu (title across top of menu possibly?)
- Change Chat Color
(opens the ccc plugin's menu)
- Toggle Robot Skin
(toggles betherobot on/off)

If I was to see the source code for this I am sure I might be able to add any other commands in myself but how to get to this point from scratch is just beyond my skills. If anyone could help it would be greatly appreciated, just looking to make it easier for our servers' donators to get to the commands they earned without having to remember all of them.

I thanks anyone and everyone who reads this post, and owe them for any insight or help they can provide. Thank you so much! Have a great day and take care!
KiRRA is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 12-29-2012 , 15:11   Re: [TF2] Simple Donator Perk Menu?
Reply With Quote #2

Hello KiRRA, try something like the following. I used the betherobot include to use the natives therein.

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <betherobot>

#define PLUGIN_VERSION "1.0.0"

public Plugin:myinfo =
{
    
name        =    "Donator Menu",
    
author        =    "KiRRA",
    
description    =    "Perks for Donators",
    
version        =    PLUGIN_VERSION,
    
url            =    "http://www.sourcemod.net"
};

new 
Handle:g_hMenuMain INVALID_HANDLE;

public 
OnPluginStart()
{
    
RegAdminCmd("sm_donator"OnDonateCmdADMFLAG_CUSTOM1"Donation Menu.");
}

public 
OnConfigsExecuted()
{
    
g_hMenuMain CreateMenu(MenuMainHandler);
    
SetMenuTitle(g_hMenuMain"Donator Menu");
    
AddMenuItem(g_hMenuMain"1""Change Chat Color");
    
AddMenuItem(g_hMenuMain"2""Toggle Robot Skin");
}

public 
Action:OnDonateCmd(clientargs)
{
    if (
client == 0)
    {
        
ReplyToCommand(client"Cannot use command from RCON.");
        return 
Plugin_Handled;
    }
    
    
DisplayMenuSafely(g_hMenuMainclient);
    return 
Plugin_Handled;
}

public 
MenuMainHandler(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_Select && IsClientInGame(param1))
    {
        switch (
param2)
        {
            case 
0:
            {
                
FakeClientCommandEx(param1"sm_ccc");                
            }
            case 
1:
            {
                if (
BeTheRobot_CheckRules(param1))
                {
                    
BeTheRobot_SetRobot(param1);
                }
            }
        }
    }
}

stock DisplayMenuSafely(Handle:menuclient)
{
    if (
client != 0)
    {
        if (
menu == INVALID_HANDLE)
        {
            
PrintToConsole(client"ERROR: Unable to open Donator Menu.");
        }
        else
        {
            
DisplayMenu(menuclientMENU_TIME_FOREVER);
        }
    }
}

public 
OnMapEnd()
{
    if (
g_hMenuMain != INVALID_HANDLE)
    {
        
CloseHandle(g_hMenuMain);
        
g_hMenuMain INVALID_HANDLE;
    }

__________________

Last edited by 11530; 12-29-2012 at 15:16.
11530 is offline
KiRRA
Senior Member
Join Date: Nov 2012
Old 12-29-2012 , 15:31   Re: [TF2] Simple Donator Perk Menu?
Reply With Quote #3

Awesome! I will give a try here shortly and see how that works out. Thank you so far for the quick help and response.

Am I correct in assuming that since I will be requiring third party includes that I must compile this from within my local server directory?
KiRRA is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 12-29-2012 , 15:54   Re: [TF2] Simple Donator Perk Menu?
Reply With Quote #4

Quote:
Originally Posted by KiRRA View Post
Awesome! I will give a try here shortly and see how that works out. Thank you so far for the quick help and response.

Am I correct in assuming that since I will be requiring third party includes that I must compile this from within my local server directory?
Correct yes, the betherobot include can be found at the bottom of the first post, here. Just stick that in your local scripting/include directory.
__________________
11530 is offline
KiRRA
Senior Member
Join Date: Nov 2012
Old 12-30-2012 , 13:14   Re: [TF2] Simple Donator Perk Menu?
Reply With Quote #5

Works beautifully! I do have one more plugin I am hoping to add into the menu but I need to have someone help me in rebuilding the plugin itself as the author no longer provides support for it and it uses an old menu that does not function anymore.

You have been such a great help! Can't thank you enough! =)
KiRRA is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 12-30-2012 , 15:19   Re: [TF2] Simple Donator Perk Menu?
Reply With Quote #6

Always happy to help. Send me a PM and we can see if we can insert a menu into this last plugin of yours.
__________________
11530 is offline
Pootisbird
Junior Member
Join Date: Jan 2013
Location: Germany
Old 01-11-2013 , 01:32   Re: [TF2] Simple Donator Perk Menu?
Reply With Quote #7

Can someone make it able unlimited ammo for donators?
Pootisbird is offline
Skippy
Senior Member
Join Date: Nov 2011
Old 01-11-2013 , 08:35   Re: [TF2] Simple Donator Perk Menu?
Reply With Quote #8

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <betherobot>

#define PLUGIN_VERSION "1.0.0"

public Plugin:myinfo =
{
    
name        =    "Donator Menu",
    
author        =    "KiRRA",
    
description    =    "Perks for Donators",
    
version        =    PLUGIN_VERSION,
    
url            =    "http://www.sourcemod.net"
};

new 
Handle:g_hMenuMain INVALID_HANDLE;

public 
OnPluginStart()
{
    
RegAdminCmd("sm_donator"OnDonateCmdADMFLAG_CUSTOM1"Donation Menu.");
}

public 
OnConfigsExecuted()
{
    
g_hMenuMain CreateMenu(MenuMainHandler);
    
SetMenuTitle(g_hMenuMain"Donator Menu");
    
AddMenuItem(g_hMenuMain"1""Change Chat Color");
    
AddMenuItem(g_hMenuMain"2""Toggle Robot Skin");
    
AddMenuItem(g_hMenuMain"3""Toggle Infinite Ammo");
}

public 
Action:OnDonateCmd(clientargs)
{
    if (
client == 0)
    {
        
ReplyToCommand(client"Cannot use command from RCON.");
        return 
Plugin_Handled;
    }
    
    
DisplayMenuSafely(g_hMenuMainclient);
    return 
Plugin_Handled;
}

public 
MenuMainHandler(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_Select && IsClientInGame(param1))
    {
        switch (
param2)
        {
            case 
0:
            {
                
FakeClientCommandEx(param1"sm_ccc");                
            }
            case 
1:
            {
                if (
BeTheRobot_CheckRules(param1))
                {
                    
BeTheRobot_SetRobot(param1);
                }
            }
            case 
2:
            {
                
FakeClientCommandEx(param1"sm_aia");
            }
        }
    }
}

stock DisplayMenuSafely(Handle:menuclient)
{
    if (
client != 0)
    {
        if (
menu == INVALID_HANDLE)
        {
            
PrintToConsole(client"ERROR: Unable to open Donator Menu.");
        }
        else
        {
            
DisplayMenu(menuclientMENU_TIME_FOREVER);
        }
    }
}

public 
OnMapEnd()
{
    if (
g_hMenuMain != INVALID_HANDLE)
    {
        
CloseHandle(g_hMenuMain);
        
g_hMenuMain INVALID_HANDLE;
    }

Then download this plugin for Infinite Ammo. http://forums.alliedmods.net/showthread.php?t=190562

Then in the admin overrides set sm_aia to your donator flag.

Last edited by Skippy; 01-11-2013 at 08:37.
Skippy is offline
Pootisbird
Junior Member
Join Date: Jan 2013
Location: Germany
Old 02-05-2013 , 15:41   AW: [TF2] Simple Donator Perk Menu?
Reply With Quote #9

Thnx
__________________


Pootisbird is offline
BonkNickeltoon
Junior Member
Join Date: Aug 2013
Old 08-13-2013 , 15:31   Re: [TF2] Simple Donator Perk Menu?
Reply With Quote #10

Can you make a menu with sm_resize, sm_resizehead, spin the wheel of fate, and godmode? I have also been having a lot of trouble setting up donator. I need a lot of help though
BonkNickeltoon 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 08:41.


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