I am trying to make a plugin that blocks the use of a given command over time
After the warning, the plugin does not block the command at all
PHP Code:
#include <sourcemod>
bool available;
public void OnPluginStart()
{
HookEvent("round_start", RoundStart);
RegConsoleCmd("sm_knife", command);
RegConsoleCmd("sm_ws", command);
}
public Action command(int client, int args)
{
if(!available)
{
PrintToChat(client, "Tej komendy możesz użyć tylko przez 30sekund od startu rundy");
PrintCenterText(client, "Tej komendy możesz użyć tylko przez 30sekund od startu rundy");
return Plugin_Handled;
}
}
public Action RoundStart(Handle event, const char[] name, bool dontBroadcast)
{
available = true;
CreateTimer(30.0, switch_command);
}
public Action switch_command(Handle timer)
{
available = false;
}
Quote:
// block_command_time.sp(20) : warning 209: function "command" should return a value
|