Sorry for the wrong section.
So well.. I managed to put a working version of it up I just copy and paste things around here lol.. but it's only limiting it for the player who typed the command.. was thinking the first person to type it.. is the one that executes it and then it would be blocked for 2 minutes for everyone else. It's looking like this:
How to make it just block the command from being used during that cooldown period, with a message saying "You must wait X, amount before you can advertise again"
Code:
#include <amxmodx>
#include <amxmisc>
#define TIMER_TASK 32490283099
#define COOLDOWN 2 //minutes
new last_used[33]
public plugin_init()
{
register_plugin("test", "1.0", "test")
register_clcmd("say /advertise", "check", 0, "- show message");
}
public client_disconnected(id) {
last_used[id] = 0;
}
public client_connect(id) {
last_used[id] = 0;
}
public check(id) {
if( (get_systime() - last_used[id]) < COOLDOWN*60) {
client_print(id,print_chat,"[AMXX] You must wait %d minute%s to use this command again.",COOLDOWN, COOLDOWN == 1 ? "" : "s")
return PLUGIN_HANDLED
}
last_used[id] = get_systime()
set_task(1.0, "advertise")
return PLUGIN_HANDLED
}
public advertise(id) {
// Some function here that would be executed ONCE! then limited.
// maybe... client.print an advertisement.. etc.
}