Туник
Участник
- Сообщения
- 1,281
- Реакции
- 263
Как правильно вписать проверку на вип?
Этот плагин защищает админов от кик-бан, хочу еще проверку на вип сделать.
Этот плагин защищает админов от кик-бан, хочу еще проверку на вип сделать.
PHP:
#pragma semicolon 1
#include <sourcemod>
public Plugin:myinfo =
{
name = "Basic Kickvote Immunity",
author = "psychoninc",
description = "Causes player kick votes to obey SM immunity levels",
version = "1.2",
url = "http://nicholashastings.com"
};
stock min(a, b) { return (((a) < (b)) ? (a) : (b)); }
public OnPluginStart()
{
AddCommandListener(callvote, "callvote");
}
public Action:callvote(client, const String:cmd[], argc)
{
// kick vote from client, "callvote %s \"%d %s\"\n;"
if (argc < 2)
return Plugin_Handled;
decl String:votereason[16];
GetCmdArg(1, votereason, sizeof(votereason));
if (!!strcmp(votereason, "kick", false))
return Plugin_Handled;
decl String:therest[256];
GetCmdArg(2, therest, sizeof(therest));
new userid = 0;
new spacepos = FindCharInString(therest, ' ');
if (spacepos > -1)
{
decl String:temp[12];
strcopy(temp, min(spacepos+1, sizeof(temp)), therest);
userid = StringToInt(temp);
}
else
{
userid = StringToInt(therest);
}
new target = GetClientOfUserId(userid);
if (target < 1)
return Plugin_Continue;
new AdminId:clientAdmin = GetUserAdmin(client);
new AdminId:targetAdmin = GetUserAdmin(target);
if (clientAdmin == INVALID_ADMIN_ID && targetAdmin == INVALID_ADMIN_ID)
return Plugin_Continue;
if (CanAdminTarget(clientAdmin, targetAdmin))
return Plugin_Continue;
PrintToChat(client, "\x07ERROR\x01: Вы не можете забанить - \x04\"%N\"", target);
return Plugin_Handled;
}