Raised This Month: $ Target: $400
 0% 

**CLOSED**L4D: Force usage of "/..." in chat --> function prototypes do not match


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Skorpion1976
Veteran Member
Join Date: Jun 2009
Location: Austria
Old 07-26-2009 , 09:27   **CLOSED**L4D: Force usage of "/..." in chat --> function prototypes do not match
Reply With Quote #1

Hi !

I use a modded version from the "Gift and Admin Buy" plugin where you have to type "!buy" or "!points" in the chat to make the corresponding menu appear. As I know that /buy is also working and this command does NOT get broadcasted to everybody else in the game, I want to force users to use the "/buy" command. Itīs so annoying people still have no clue of how to make a keybind and keep spamming the chat window permanently with non relevant stuff.

This is the .sp file now:

1. The commands:
RegConsoleCmd("buy", PointsMenu);
RegConsoleCmd("points", ShowPoints);

2. The corresponding public actions:

Code:
public Action:PointsMenu(client,args)
{
    if(pointson)
    {
        if(pointsteam[client] != SURVIVORTEAM)
        {
            InfectedPointsMenuFunc(client);
        }
        else
        {
            PointsMenuFunc(client);
        }
    }
   return Plugin_Handled;
}

public Action:ShowPoints(client,args)
{
    if(pointson)
    {
        ShowPointsFunc(client);
    }
    return Plugin_Handled;
}
I found a modded version from the "Character Select" Plugin (http://forums.alliedmods.net/showpos...1&postcount=13) where the programmer catches words from the chat and compares them with a specific word. If thereīs a match, the character menu opens, if not, it does not open. Exactly what I need! So I took it and changed it, because just copy/paste his code into my plugin resulted in plenty of warnings.

This is the "character select" stuff, which i added into my .sp file:
1. the command:
RegConsoleCmd("say", Command_Say);

2. the code:
Code:
public Action:Command_Say(client, args)
{
    new String:text[192];
    GetCmdArgString(text, sizeof(text));
    new startidx = 0;
    if (text[0] == '"')
    {
        startidx = 1;
        /* Strip the ending quote, if there is one */
        new len = strlen(text);
        if (text[len-1] == '"')
        {
            text[len-1] = '\0';
        }
    }
    if (StrEqual(text[startidx], "/buy"))
    {
        CreateTimer(0.1, PointsMenu, client);
    }
    /* Block the client's message from broadcasting */
    if(StrEqual(text[startidx], "/points"))
    {
        CreateTimer(0.1, ShowPoints, client);
    }
}
The SM 1.2.0 compiler throws 2 errors:

"error 100, function prototypes do not match."
---> this is the line: CreateTimer(0.1, ShowPoints, client);
---> this is the line: CreateTimer(0.1, PointsMenu, client);

HELP please !
Be informed that I am NOT a professional C++ coder, I just reactivated some knowledge but that is too little to fix the issue

Last edited by Skorpion1976; 08-05-2009 at 08:22.
Skorpion1976 is offline
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 07-26-2009 , 09:30   Re: L4D: Force usage of "/..." in chat --> function prototypes do not match
Reply With Quote #2

You really need to use or tags for code highlighting.
__________________
For admins: My plugins

For developers: Colors library
exvel is offline
Send a message via ICQ to exvel
Skorpion1976
Veteran Member
Join Date: Jun 2009
Location: Austria
Old 08-04-2009 , 10:29   Re: L4D: Force usage of "/..." in chat --> function prototypes do not match
Reply With Quote #3

As I receive no answers I think the whole stuff might be too complex ?

Workaround: Is it possible to SUPPRESS the broadcast of the "!" commands so the chat box does not get spammed anymore ? The commands themselves should work of course.
Skorpion1976 is offline
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 08-04-2009 , 10:47   Re: L4D: Force usage of "/..." in chat --> function prototypes do not match
Reply With Quote #4

Try this:

PHP Code:
RegConsoleCmd("say"FilterChat);
RegConsoleCmd("say_team"FilterChat);

public 
Action:FilterChat(clientargs)
{
    if (
args 0)
    {
        
decl String:szMessage[255];
        
GetCmdArg(1szMessagesizeof(szMessage));
        
TrimString(String:szMessage);
        
        if (
StrEqual(szMessage"!command_name"false))
        {
            return 
Plugin_Handled;
        }
    }
    
    return 
Plugin_Continue;

Also if you want all cmds of all plugins to be silent in chat you can just configure core.cfg.
__________________
For admins: My plugins

For developers: Colors library
exvel is offline
Send a message via ICQ to exvel
Skorpion1976
Veteran Member
Join Date: Jun 2009
Location: Austria
Old 08-04-2009 , 16:24   Re: L4D: Force usage of "/..." in chat --> function prototypes do not match
Reply With Quote #5

Man, you saved my day !!!
Working fine and chat box clean and tidy

Thank you very much !
Skorpion1976 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 18:30.


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