Utilisation des groupes pour les admins / casteurs

This commit is contained in:
rick 2021-05-18 20:04:27 +02:00
parent 850d847096
commit 702693e156
Signed by: Rick
GPG key ID: 2B593F087240EE99

26
test.sp
View file

@ -10,7 +10,6 @@
char teamCT[6][150];
char teamT[6][150];
char authorised[20][128];
char clientId[128];
public Plugin myinfo =
@ -32,17 +31,23 @@ public void OnPluginStart()
RegServerCmd("!team", SetTeam);
PrintToServer("Hello world!");
PrintToServer("%d", sizeof(authorised));
}
//public void OnClientAuthorized(int client, const char[] auth)
public void SuperTest(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
GetClientAuthId(client, AuthId_Steam2, clientId, sizeof(clientId));
if (!strcmp(clientId, "BOT", true)) { return; }
if (FindAdminByIdentity("steam", clientId) != INVALID_ADMIN_ID)
{
ChangeClientTeam(client, CS_TEAM_SPECTATOR);
}
else
{
bool allGood = GetClientAuthId(client, AuthId_SteamID64, clientId, sizeof(clientId));
if (allGood)
{
PrintToServer("== ID OK ==");
allGood = false;
int i = 1;
while (!allGood && i < sizeof(teamCT))
@ -60,18 +65,6 @@ public void SuperTest(Event event, const char[] name, bool dontBroadcast)
i++;
}
if (!allGood)
{
i = 0;
while (!allGood && i < sizeof(authorised))
{
if (!strcmp(authorised[i], clientId, false))
{
allGood = true;
ChangeClientTeam(client, CS_TEAM_SPECTATOR);
}
i++;
}
if (!allGood)
{
KickClient(client, "Vous nêtes pas autorisé à suivre / jouer \
sur ce serveur");
@ -134,7 +127,8 @@ public void ServeurLibre(Event event, const char[] name, bool dontBroadcast)
{
// requete post pour match fini et serveur libre
Handle socket = SocketCreate(SOCKET_TCP, OnSocketError);
//SocketConnect(socket, OnSocketConnected, OnSocketReceive, OnSocketDisconnected, MY_SOCKET_IP, MY_SOCKET_PORT);
//SocketSetArg(socket, CS_GetTeamScore(CS_TEAM_T), CS_GetTeamScore(CS_TEAM_CT));
//SocketConnect(socket, SocketEnvoieVictoire, OnSocketReceive, OnSocketDisconnected, MY_SOCKET_IP, MY_SOCKET_PORT);
}