#pragma semicolon 1
#include <sourcemod>
//#define DEBUG
#define VERSION "0.0.1"
public Plugin:myinfo =
{
name = "Player change name lock",
author = "",
description = "",
version = VERSION,
url = "http://..."
};
new Handle:lockTime[MAXPLAYERS+1];
public OnPluginStart()
{
HookEvent("player_changename", PlayerChangeName, EventHookMode_Pre);
}
public Action:PlayerChangeName(Handle:event, const String:name[], bool:dontBroadcast)
{
decl client;
client = GetClientOfUserId(GetEventInt(event, "userid"));
if(lockTime[client] != INVALID_HANDLE)
{
KillTimer(lockTime[client]);
lockTime[client] = INVALID_HANDLE;
KickClient(client, "Вы были выгнаны с сервера.\nНа сервере запрещено менять ник чаще чем раз в минуту");
}
lockTime[client] = CreateTimer(60.0, CallBack_Time, client, TIMER_FLAG_NO_MAPCHANGE);
}
public Action:CallBack_Time(Handle:timer, any:client)
{
PrintToChat(client, "[SM] Вы снова можете сменить ник.");
lockTime[client] = INVALID_HANDLE;
}