pragma semicolon include sourcemod define DEBUG define VERSION public

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#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;
}