Raised This Month: $ Target: $400
 0% 

Help editing script


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
|FMS|*KENNY
Junior Member
Join Date: Jan 2008
Old 05-29-2009 , 17:29   Help editing script
Reply With Quote #1

Well I know absolutely nothing about scripting plugins, I have been using a plugin that blocks a certain cvar from being used in game. I downloaded the source and edited out the cvar it was originally blocking with the one I wanted to block. The plugin works great. I just wanted to know what code to add so when someone is banned for using the cvar a message is shown to the users on the server. Currently it just gives the user the reason why they were banned. (Banned for using a prohibited command) I want it to show up in chat and say "Player [playername] has been permanently banned for using an illegal command."

This is for a L4D server if that makes a difference.

Here is the original code from the flytrap plugin. I take no credit for this plugin or code, it belongs to floor_master. Thanks
Code:
// vim: set filetype=c :

#include <sourcemod>

#define CVAR_BAN_MSG        0
#define CVAR_VERSION        1
#define CVAR_NUM_CVARS        2

#define FLYTRAP_VERSION        "1.1"

public Plugin:myinfo = {
    name = "Command Exploit Flytrap",
    author = "FLOOR_MASTER",
    description = "Automatically ban anyone attempting server-crashing debug commands",
    version = FLYTRAP_VERSION,
    url = "http://www.2fort2furious.com"
};

new Handle:g_cvars[CVAR_NUM_CVARS];

public OnPluginStart() {
    RegConsoleCmd("sv_benchmark_force_start", Command_CrashAttempt);
    RegConsoleCmd("sv_soundscape_printdebuginfo", Command_CrashAttempt);
    RegConsoleCmd("ai_test_los", Command_CrashAttempt);

    g_cvars[CVAR_BAN_MSG] = CreateConVar(
    "flytrap_banmsg",
    "Banned for using a prohibited command",
    "Message to display when kicking/banning the player",
    FCVAR_PLUGIN);

    g_cvars[CVAR_VERSION] = CreateConVar(
    "flytrap_version",
    FLYTRAP_VERSION,
    "Command Exploit Flytrap Version",
    FCVAR_PLUGIN|FCVAR_REPLICATED|FCVAR_NOTIFY);
}

public Action:Command_CrashAttempt(client, args) {
    if (client) {
    decl String:ban_msg[128];
        decl String:command[32];
        GetConVarString(g_cvars[CVAR_BAN_MSG], ban_msg, sizeof(ban_msg));

        GetCmdArg(0, command, sizeof(command));

        LogAction(client, -1, "%L attempted %s, banning", client, command);
        BanClient(client, 0, BANFLAG_AUTHID, ban_msg, ban_msg);
    }
    return Plugin_Handled;
}
__________________
|FMS|*KENNY is offline
 



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 20:50.


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