AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   blocking using exec command (https://forums.alliedmods.net/showthread.php?t=159167)

Dr7sTyLe 06-13-2011 14:06

blocking using exec command
 
how can i block using the "exec [file]" command
like if somone use in console "exec flood.cfg"
or something

fysiks 06-13-2011 18:47

Re: blocking using exec command
 
"exec" is a client command that is never sent to the server (i.e. it's not possible to block it with a plugin).

Hunter-Digital 06-13-2011 19:20

Re: blocking using exec command
 
It's useless anyway, if you want to block the flood, get that flood.cfg file and see what commands it abuses, and add flood control to them... meaning, they won't allow repeatitive usage in a short time, that can be EASILY done by adding a simple code before the function:

Code:

const g_fWaitTime = 3.0 // can't re-use something within 3 seconds


public spammyFunction(id)
{
    static Float:fGameTime
    static Float:fLastUsed[33]

    fGameTime = get_gametime()

    if(fLastUsed[id] < (fGameTime - g_fWaitTime))
        return PLUGIN_HANDLED // or whatever the function returns when cancelled

    fLastUsed[id] = fGameTime

    // the rest of the code...
}



All times are GMT -4. The time now is 23:26.

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