Something like this should work. Made the cooldown 10 seconds, just change the amount in CreateTimer if you want it shorter/longer.
PHP Code:
new bool:IsOnCoolDown[MAXPLAYERS+1] = false;
public OnClientPutInServer(client)
{
IsOnCoolDown[client] = false;
}
public OnPluginStart()
{
HookEvent("player_builtobject", Event_BuiltObject);
AddCommandListener(BuildCallback, "build");
}
public Event_BuiltObject(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if(GetEventInt(event, "object") == 2)
{
IsOnCoolDown[client] = true;
CreateTimer(10.0, CoolDownTimer, client);
}
}
public Action:BuildCallback(client, const String:command[], argc)
{
new String:buffer[4], iBuffer;
GetCmdArg(1, buffer, sizeof(buffer));
iBuffer = StringToInt(buffer);
if(iBuffer == 2 && IsOnCoolDown[client])
{
PrintToChat(client, "Sentry still on cooldown");
return Plugin_Handled;
}
return Plugin_Continue;
}
public Action:CoolDownTimer(Handle:timer, any:client)
{
IsOnCoolDown[client] = false;
}