Raised This Month: $51 Target: $400
 12% 

!donators help (Basic Donator Interface)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 04-04-2012 , 02:15   !donators help (Basic Donator Interface)
Reply With Quote #1

I've been using the Basic Donator Interface plugin on my server with minor script changes to when someone types !vip it opens the menu.

I'm in need of some help however. Many players who are not vip type it but nothing will happen. Curious if it is possible to make it when a non vip player (or donator) types !vip, that a menu pops up saying how to donate and donation perks (my configuration).

And how would I make it so in chat, when !vip is typed, it wont show.

Few questions I've been curious about for awhile.
ReFlexPoison is offline
Doodil
Senior Member
Join Date: Mar 2012
Old 04-04-2012 , 08:01   Re: !donators help (Basic Donator Interface)
Reply With Quote #2

the part of the plugin that handles the chat-trigger is the following in OnPluginStart():
Code:
    AddCommandListener(SayCallback, "say");
    AddCommandListener(SayCallback, "say_team");
and the whole SayCallBack-function:

Code:
public Action:SayCallback(iClient, const String:command[], argc)
{
    if(!iClient) return Plugin_Continue;
    if (!g_bIsDonator[iClient]) return Plugin_Continue;
    
    decl String:szArg[255];
    GetCmdArgString(szArg, sizeof(szArg));

    StripQuotes(szArg);
    TrimString(szArg);
    
    if (StrEqual(szArg, CHAT_TRIGGER, false))
    {
        ShowDonatorMenu(iClient);
        return Plugin_Handled;
    }
    return Plugin_Continue;
}
the function returns Plugin_Continue; if it wants the message to be send, and Plugin_Handled; if it wants to prevent that the message gets send.

One of the first lines is "if (!g_bIsDonator[iClient]) return Plugin_Continue;", which pretty much says "if a non-vip says something, pass it through and dont bother about what happens after this line"

so if you want to display something to non-vips change the function to:

Code:
public Action:SayCallback(iClient, const String:command[], argc)
{
    if(!iClient) return Plugin_Continue;
    
    decl String:szArg[255];
    GetCmdArgString(szArg, sizeof(szArg));

    StripQuotes(szArg);
    TrimString(szArg);
    
    if (StrEqual(szArg, CHAT_TRIGGER, false))
    {
        if(g_bIsDonator[iClient])
        {
            ShowDonatorMenu(iClient);
            return Plugin_Handled;
        }
        else
        {
            //Whatever you want to happen when a non-vip says !vip
            
            return Plugin_Handled;
        }
    }
    return Plugin_Continue;
}
Doodil is offline
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 04-04-2012 , 11:48   Re: !donators help (Basic Donator Interface)
Reply With Quote #3

Does the new function you showed me open a menu with whatever I type, or does it just say it in chat? Can't test atm. (Tis busy)

And I don't think I fully understand. You showed me the function for the chat message, but what hides it? (Probably misses something in your post)
ReFlexPoison is offline
Doodil
Senior Member
Join Date: Mar 2012
Old 04-04-2012 , 11:54   Re: !donators help (Basic Donator Interface)
Reply With Quote #4

atm it doesn't do anything since you weren't too specific what you want to happen, it just shows were you would have to add your code.

The hiding part is wether you return "Plugin_Continue" or "Plugin_Handled", if you return "Plugin_Continue" then you tell the server to proceed with the command (in this case showing the message to the chat), when you return "Plugin_Handled" you tell the server that you took care of that and that it no longer needs to take care of message (didn't test it myself and I just hope that "return Plugin_Handled" blocks messages when used with "say/say_team" and the command listener [according to the api it should block it, but it doesn't work for all commands yet])
Doodil is offline
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 04-04-2012 , 12:11   Re: !donators help (Basic Donator Interface)
Reply With Quote #5

Quote:
Originally Posted by Doodil View Post
atm it doesn't do anything since you weren't too specific what you want to happen, it just shows were you would have to add your code...
Might as well just make it respond to player in chat that types it "something." How would I script that, I'm pretty much a noob atm.
ReFlexPoison is offline
Doodil
Senior Member
Join Date: Mar 2012
Old 04-04-2012 , 12:13   Re: !donators help (Basic Donator Interface)
Reply With Quote #6

replace the original function with

Code:
public Action:SayCallback(iClient, const String:command[], argc)
{
    if(!iClient) return Plugin_Continue;
    
    decl String:szArg[255];
    GetCmdArgString(szArg, sizeof(szArg));

    StripQuotes(szArg);
    TrimString(szArg);
    
    if (StrEqual(szArg, CHAT_TRIGGER, false))
    {
        if(g_bIsDonator[iClient])
        {
            ShowDonatorMenu(iClient);
            return Plugin_Handled;
        }
        else
        {
            PrintToChat(iClient,"Something");
            
            return Plugin_Handled;
        }
    }
    return Plugin_Continue;
}
Doodil is offline
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 04-04-2012 , 12:16   Re: !donators help (Basic Donator Interface)
Reply With Quote #7

Sweet deal. Will test when I get home. Thanks for the help.
ReFlexPoison 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 16:47.


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