Quote:
Originally Posted by Michael Shoe Maker
Read the API....
PHP Code:
CreateTimer(10.0, IsAdminOnline, TIMER_REPEAT);
Arg2 is a function.
|
+1
Also, I think OnClientDisconnect and OnClientPostAdminCheck are useless since you're applying a repeating 10 seconds timer to check for admins. Why not 1 second?
Edit: Didn't read the first post thoroughly. If you're blocking those commands from another plugin, it should be:
PHP Code:
#pragma semicolon 1 // I really love semi-colons
#pragma newdecls required // it is the hip thing now, baby!
#include <sourcemod>
#include <sdktools>
#include <cstrike>
bool AdminOnServer;
public Plugin myinfo =
{
name = "Gamevoting Disable",
author = "Kempus",
description = "Wyłącza głosowanie gdy admini są dostępni",
version = "1.0",
url = "http://cs-lajtowo.pl/"
};
public void OnPluginStart()
{
AddCommandListener(CommandVote, "voteban");
AddCommandListener(CommandVote, "votekick");
AddCommandListener(CommandVote, "votemute");
AddCommandListener(CommandVote, "votegag");
CreateTimer(1.0, IsAdminOnline, _, TIMER_REPEAT);
}
public Action IsAdminOnline(Handle timer)
{
if (!IsServerProcessing())
{
return Plugin_Continue;
}
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && !IsFakeClient(i))
{
if (GetUserFlagBits(i) & ADMFLAG_GENERIC)
{
if (!AdminOnServer)
{
AdminOnServer = true;
}
}
else
{
if (AdminOnServer)
{
AdminOnServer = false;
}
}
}
}
return Plugin_Continue;
}
public Action CommandVote(int client, const char[] command, int args)
{
if (!AdminOnServer)
{
return Plugin_Continue;
}
PrintToChat(client, "[\x06Gamevoting\x01] \x06Głosowanie jest niedostępne, administrator jest dostępny");
return Plugin_Handled;
}