View Single Post
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