Код
#include <sourcemod>
#include <morecolors>
public OnPluginStart()
{
AddCommandListener(Command_Changeteam, "say");
AddCommandListener(Command_Changeteam, "say_team");
}
public Action:Command_Changeteam(client, const String:command[], args)
{
decl String:Said[64];
GetCmdArgString(Said, sizeof(Said) - 1);
StripQuotes(Said);
TrimString(Said);
if (client > 0)
{
if( StrEqual( Said, "!t", false ) || StrEqual( Said, "t", false ))
{
if (GetClientTeam(client) == 3 || GetClientTeam(client) == 1)
{
ChangeClientTeam(client, 2);
CPrintToChat(client, "{ghostwhite} [SM]{yellow}Вы перешли за {fullred}Т");
return Plugin_Continue;
}
if (GetClientTeam(client) == 2)
{
CPrintToChat(client, "{ghostwhite} [SM]{yellow}Вы уже в команде {fullred}Т");
return Plugin_Continue;
}
}
if( StrEqual( Said, "!ct", false ) || StrEqual( Said, "ct", false ))
{
if (GetUserFlagBits(client) & ADMFLAG_ROOT && !(GetClientTeam(client) == 3))
{
ChangeClientTeam(client, 3);
CPrintToChat(client, "{ghostwhite} [SM]{yellow}Вы перешли за {deepskyblue}КТ");
return Plugin_Continue;
}
if (GetClientTeam(client) == 3)
{
CPrintToChat(client, "{ghostwhite} [SM]{yellow}Вы уже в команде {deepskyblue}КТ");
return Plugin_Continue;
}
if (!(GetUserFlagBits(client) & ADMFLAG_ROOT))
{
CPrintToChat(client, "{ghostwhite} [SM]{yellow}У вас нет доступа к этой команде");
return Plugin_Continue;
}
}
if( StrEqual( Said, "!spec", false ) || StrEqual( Said, "spec", false ))
{
if (GetClientTeam(client) == 2 || GetClientTeam(client) == 3)
{
ChangeClientTeam(client, 1);
CPrintToChat(client, "{ghostwhite} [SM]{yellow}Вы перешли в {black}наблюдатели");
return Plugin_Continue;
}
if (GetClientTeam(client) == 1)
{
CPrintToChat(client, "{ghostwhite} [SM]{yellow}Вы уже в {black}наблюдателях");
return Plugin_Continue;
}
}
}
return Plugin_Continue;
}
Правилен ли мой код? Все работает. Только я думаю где-то не хватает любимого return Plugin_Handled