Raised This Month: $ Target: $400
 0% 

Limted admin Slap / Slay / Ban / Kick


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 10-06-2008 , 20:31   Re: Limtied admin Slap / Slay / Ban / Kick
Reply With Quote #1

I don't think I need to reset the count when people disconnect. It rather depends on how high you set the cvars.

You need to place this plugin's file name above admincmd.amxx in plugins.ini.

Code:
#include <amxmodx> #pragma semicolon 1 #define SLAP 0 #define SLAY 1 #define KICK 2 #define BAN 3 new pcvars[4]; public plugin_init() {     register_plugin("Command Limits", "1.0", "Lee");         register_clcmd("amx_slap", "cmdSlap", ADMIN_LEVEL_D);     register_clcmd("amx_slay", "cmdSlay", ADMIN_LEVEL_D);     register_clcmd("amx_kick", "cmdKick", ADMIN_LEVEL_D);     register_clcmd("amx_ban", "cmdBan", ADMIN_LEVEL_D);         pcvars[SLAP] = register_cvar("amx_slap_usage", "30");     pcvars[SLAY] = register_cvar("amx_slay_usage", "30");     pcvars[KICK] = register_cvar("amx_kick_usage", "30");     pcvars[BAN] = register_cvar("amx_ban_usage", "30"); } public cmdSlap(playerID, accessLevel) {     return get_user_flags(playerID) & accessLevel ? canUseCommand(playerID, SLAP) : PLUGIN_CONTINUE; } public cmdSlay(playerID, accessLevel) {     return get_user_flags(playerID) & accessLevel ? canUseCommand(playerID, SLAY) : PLUGIN_CONTINUE; } public cmdKick(playerID, accessLevel) {     return get_user_flags(playerID) & accessLevel ? canUseCommand(playerID, KICK) : PLUGIN_CONTINUE; } public cmdBan(playerID, accessLevel) {     return get_user_flags(playerID) & accessLevel ? canUseCommand(playerID, BAN) : PLUGIN_CONTINUE; } canUseCommand(playerID, commandIssued) {     static lastUseTime[33][4];         new currentTime = get_systime();     new nextUse = lastUseTime[playerID][commandIssued] - currentTime + get_pcvar_num(pcvars[commandIssued]);         if(nextUse > 0)     {         client_print(playerID, print_console, "Error: You cannot use this command for another %d second%s.",             nextUse, nextUse > 1 ? "s" : "");                     return PLUGIN_HANDLED;     }         lastUseTime[playerID][commandIssued] = currentTime;         return PLUGIN_CONTINUE; }
__________________
No support via PM.
Lee 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 23:10.


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