Raised This Month: $ Target: $400
 0% 

Script Question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bman87
Senior Member
Join Date: Dec 2008
Location: Michigan
Old 01-08-2009 , 13:44   Script Question
Reply With Quote #1

This is my first plugin attempt .

PHP Code:
#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION "1.0"


public Plugin:myinfo 
{
    
name "L4D Vocalize Blocker",
    
author "B-Man",
    
description "Blocks vocalize command",
    
version PLUGIN_VERSION,
    
url "http://www.tchalo.com"
}

public 
OnPluginStart()
{
    
RegConsoleCmd("vocalize"vocal_stop);
    
CreateConVar("l4d_vocalize_block_v"PLUGIN_VERSION"L4D Vocalize Blocker Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
}

public 
Action:vocal_stop(clientargs)
{
    
PrintToChat(client"[SM] Vocalize command is blocked");
    return 
Plugin_Handled;

This works, just not as intended. It will block the command but it also blocks anything that calls the vocalize command, like in the radial menu and when the computer does any of the vocalize stuff.

Is there a way to check to see if this was a command input manually in the console or called from somewhere else?
bman87 is offline
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 01-08-2009 , 13:48   Re: Script Question
Reply With Quote #2

if client == 0, its the server. so just change the vocal_stop function to his:
PHP Code:
public Action:vocal_stop(clientargs)
{
    if(
client != 0)
    {
        
PrintToChat(client"[SM] Vocalize command is blocked");
        return 
Plugin_Handled;
    }
    return 
Plugin_Continue;

__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)
Lebson506th is offline
bman87
Senior Member
Join Date: Dec 2008
Location: Michigan
Old 01-08-2009 , 14:02   Re: Script Question
Reply With Quote #3

Thanks! That works better. But as a player you still cannot use the radial menu to use the vocalize command. The bots will be able to vocalize, but no human players. I just don't want human players to abuse the command; but would still like them to use the radial menu and random vocalization.


Any ideas? or am I trying to do something impossible?
bman87 is offline
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 01-08-2009 , 14:42   Re: Script Question
Reply With Quote #4

Uhhhh. If you want to prevent spamming you could have an array that stores the last time they did it and check that versus a set time limit.


As for blocking it form one thing but not the other... duno.
__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)
Lebson506th is offline
Grrrrrrrrrrrrrrrrrrr
Senior Member
Join Date: Oct 2007
Old 01-14-2009 , 20:12   adsasd
Reply With Quote #5

Code:
#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION "1.0"

new clientLastCallTime[MAXPLAYERS+1];
public Plugin:myinfo = 
{
    name = "L4D Vocalize Blocker",
    author = "B-Man",
    description = "Blocks vocalize command",
    version = PLUGIN_VERSION,
    url = "http://www.tchalo.com"
}

public OnPluginStart()
{
    RegConsoleCmd("vocalize", vocal_stop);
    CreateConVar("l4d_vocalize_block_v", PLUGIN_VERSION, "L4D Vocalize Blocker Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
}

public Action:vocal_stop(client, args)
{
    decl String:time[16];
    FormatTime(time, sizeof(time), "%H%M%S");
    new time_now = StringToInt(time);

    //not the world and the last time the client called this command was at a minimum of 6 seconds ago 
    //and if not, block the command
    if(client!=0 && (time_now-clientLastCallTime[client])<=6)
    {
        clientLastCallTime[client] = time_now;
        PrintToChat(client, "[SM] You may only use the Vocalize command every 6 seconds.");
        return Plugin_Handled;
    }
    return Plugin_Continue;
 }  
__________________
Note: "r" letters = 19 ; CHEESE: I LIKE CHOCOLATE MILK

Last edited by Grrrrrrrrrrrrrrrrrrr; 01-15-2009 at 12:08. Reason: I added "return Plugin_Continue;" to vocal_stop
Grrrrrrrrrrrrrrrrrrr is offline
Send a message via AIM to Grrrrrrrrrrrrrrrrrrr
SirLamer
Senior Member
Join Date: Oct 2008
Old 01-15-2009 , 13:40   Re: Script Question
Reply With Quote #6

"AAAAAAAAHHHHHHH... AaaaaaaHAHAHAHAHAAHAHAAHHHHHMMMMHHGgGFGDSGDFH HFH...... AAAAAAHAAHHHHHHHHHAAAAAAAAHHHAAH.,..... EEEEEEEEEEECCHCHCHCHCHCHCHC"

lol, why would you want to block this? What the hell else are people supposed to do while riding up the elevator?

Just block "vocalize playerdeath", which I think is probably the one you really care about.
SirLamer 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 07:41.


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