View Single Post
Author Message
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 08-09-2013 , 12:00   [ANY] Spray Manager (1.5.1)
Reply With Quote #1

Spray Manager by shavit
The ultimate spray manager

Version 1.5.0

Description:
Spray Manager is a plugin that was made for my server and has some useful features.

Features:
Spray Manager includes features that can help you in a case of an inappropriate spray, or just a spray that you don't want to see.

Commands:
* All the commands can be accessed through the admin menu under Player Commands in-case that adminmenu.smx is loaded.
** All the commands can be used in the chat as !command or /command (default chat triggers) instead of sm_command.

sm_sprayban or sm_sban - Usage: sm_sprayban <target>
Bans a player from spraying.
Needed access: Ban

sm_offlinesprayban or sm_offlinesban - Usage: sm_offlinesprayban <steamid> [name]
Spray ban a player even if he's offline. In case that he's online, he will be automatically spray banned in-game w/o reconnecting.

sm_offlinesban "STEAM_0:0:59898856" "shavit" for example would spray ban me.
Needed access: Ban

sm_sprayunban or sm_sunban - Usage: sm_sprayunban <target>
Unbans a spray banned player from spraying.

Needed access: Unban

sm_sbans or sm_spraybans - Usage: sm_spraybans
Unbans a spray banned player from spraying.

Needed access: Generic

sm_allsbans or sm_offlinesbans - Usage: sm_allsbans
Shows a list of all spray banned players, even if they're not in-game.
After selecting someone, you will be able to remove his spray ban if you have the "Unban" access.
Needed access: Generic

Screenshots of the menu


Admin Menu Support:
This plugin comes with support for the basic admin menu plugin that comes with SourceMod, and include its commands in the Player Commands category.

Example:
Spoiler


Requirements:
MetaMod: Source 1.10 developer snapshot+
SourceMod 1.5 developer snapshot+
The basic adminmenu.smx plugin that comes with SourceMod.
The basic Client Preferences (clientprefs) extension & plugin that comes with SourceMod.
SMLib to compile.

Installation:


Add the "spraymanager" field to addons/sourcemod/configs/databases.cfg

MySQL:
Code:
"spraymanager"
    {
        "driver"        "default"
        "host"        "ip/hostname"
        "database"        "database"
        "user"        "username"
        "pass"        "password"
        "port"        "3306"
    }
SQLite:
Code:
"spraymanager"
    {
        "driver"        "sqlite"
        "database"        "spraymanager"
    }
Example:
Spoiler


Planned Features:
MySQL/SQLite support. - Done!

Add sm_allsbanned/sm_allspraybanned command that will display a menu that shows who got spray banned, even if they're offline.
- Done!
Add sm_offlinesban/sm_offlinesprayban command that you can ban a SteamID from spraying even if the player is not playing right now.
- Done!

ConVars:
Code:
 // ConVars for plugin "spraymanager.smx"
Code:
// "Spray Manager" version
// -
sm_spraymanager_version "1.2"

 // Enable "Spray Manager"?
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
sm_spraymanager_enabled "1"

// Where players will see the owner of the spray that they're aiming at?
// 0 - Disabled
// 1 - Hud hint http://i.imgur.com/R1AyN5h.jpg
// 2 - Hint text (like sm_hsay) http://i.imgur.com/5TS4P4p.jpg
// 3 - Center text (like sm_csay) http://i.imgur.com/NEhtie0.jpg
// 4 - HUD (if supported by the game) (I can't post a screenshot, if someone runs it on a game that supports HUD please give me a screenshot)
// 5 - Top left (like sm_tsay) http://i.imgur.com/m3o7YkL.jpg
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "5.000000"
sm_spraymanager_textloc "1"

// Prevent spray-on-spray overlapping?
// If enabled, specify an amount of units that another player spray's distance from the new spray needs to be it or more, recommended value is 75.
// -
// Default: "1"
// Minimum: "0.000000"
sm_spraymanager_overlap "0"

// Which authentication identifiers should be seen in the HUD?
// - This is a "math" cvar, add numbers for your likings. (Example: 1 + 4 = 5/Name + IP address)
// 1 - Name
// 2 - SteamID
// 4 - IP address
// -
// Default: "1"
// Minimum: "1.000000"
sm_spraymanager_auth "1"
* This config file is auto-created in srcds/mod/cfg/sourcemod with the name spraymanager.cfg.

Developers' API:
The plugin comes with an include file that you can easily use with other plugins.

Natives:
Code:
/**
 * Ban a player from using sprays.
 * 
 * @param client                    Client index.
 * @param delete                    Delete the client's spray if it's there?
 * @error                    Throw error if client is invalid/already spray banned.
 * @noreturn
 */
native SprayManager_BanClient(client, bool:delete = true);

/**
 * Unban a spray banned player from using sprays.
 * 
 * @param client                    Client index.
 * @error                    Throw error if client is invalid/not banned.
 * @noreturn
 */
native SprayManager_UnbanClient(client);

/**
 * Check if the client is spray banned.
 * @param client                    Client index.
 * @error                    Throw error if client is invalid.
 * @return                 True if spray banned, false otherwise.
 */
native SprayManager_IsBanned(client);


Forwards:
Code:
/**
 * Called when a client gets spray banned.
 *
 * @param client        Client index
 *
 * @noreturn
 */
forward SprayManager_OnBan(client);

/**
 * Called when a client gets spray unbanned.
 *
 * @param client        Client index
 *
 * @noreturn
 */
forward SprayManager_OnUnban(client);


Example of usage:
Code:
#include <sourcemod>
#include <spraymanager>

#pragma semicolon 1

public Plugin:myinfo = 
{
    name = "[Spray Manager] Ban Check",
    author = "shavit",
    description = "Check if you are banned from spraying",
    version = "1.0",
    url = "not vgames"
}

public OnPluginStart()
{
    RegConsoleCmd("sm_sbanned", Command_SBanned, "Are you spray banned?");
}

public Action:Command_SBanned(client, args)
{
     ReplyToCommand(client, "\x04[Spray Manager]\x01 You are %s.",  SprayManager_IsBanned(client)? "\x07FF0000BANNED":"\x0700FFAANOT  BANNED");
    
    return Plugin_Handled;
}
Change Log:
Code:
1.5.1 -
* Fixed an SQL syntax error, most likely fixed some stuff

1.5.0 -
+ Added an option to choose what you wanna see in the HUD. (SteamID, IP, name or combine between them)

1.4.0 -
+ Added a basic anti-spray-on-spray (anti-overlapping) feature that is disabled as default. Idea by AeroAcrobat/salsav91 and base code by MasterOfTheXP.

1.3.1 -
* Hotfix for error log spam when the (My)SQL server is unavailable for more than 5 times.
(The max connections can be edited through the plugin but requires a recompile)

1.3 -
* SQLite error fix.

1.2 -
+ Added offline spray ban list.
+ Added an option to spray un-ban players in the list.
+ Added sm_offlinesprayban/sm_offlinesprayban <steamid> [name] to manually spray ban players even if they're offline.
* Minor bug fixes.

1.1 -
+ Added MySQL/SQLite support
+ Now, when you spray ban a player the plugin is removing his spray immediatly.
+ Added a new parameter to the SprayManager_BanClient native.
- Removed "Client Preferences" requirement.
* Minor optimization.

1.0 -
Initial release
Attached Files
File Type: inc spraymanager.inc (1.5 KB, 1187 views)
File Type: sp Get Plugin or Get Source (spraymanager.sp - 929 views - 29.6 KB)
File Type: smx spraymanager.smx (28.6 KB, 1046 views)
__________________
retired

Last edited by shavit; 12-23-2014 at 11:23.
shavit is offline