From 702693e156aead43a491a0ac6bc0df05521bbb8c Mon Sep 17 00:00:00 2001 From: rick Date: Tue, 18 May 2021 20:04:27 +0200 Subject: [PATCH] Utilisation des groupes pour les admins / casteurs --- test.sp | 48 +++++++++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/test.sp b/test.sp index 3933a18..4cbf5ef 100644 --- a/test.sp +++ b/test.sp @@ -10,7 +10,6 @@ char teamCT[6][150]; char teamT[6][150]; -char authorised[20][128]; char clientId[128]; public Plugin myinfo = @@ -32,42 +31,36 @@ 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")); - bool allGood = GetClientAuthId(client, AuthId_SteamID64, clientId, sizeof(clientId)); - if (allGood) + GetClientAuthId(client, AuthId_Steam2, clientId, sizeof(clientId)); + if (!strcmp(clientId, "BOT", true)) { return; } + if (FindAdminByIdentity("steam", clientId) != INVALID_ADMIN_ID) { - PrintToServer("== ID OK =="); - allGood = false; - int i = 1; - while (!allGood && i < sizeof(teamCT)) + ChangeClientTeam(client, CS_TEAM_SPECTATOR); + } + else + { + bool allGood = GetClientAuthId(client, AuthId_SteamID64, clientId, sizeof(clientId)); + if (allGood) { - if (!strcmp(teamCT[i], clientId, false)) + allGood = false; + int i = 1; + while (!allGood && i < sizeof(teamCT)) { - ChangeClientTeam(client, CS_TEAM_CT); - allGood = true; - } - else if (!strcmp(teamT[i], clientId, false)) - { - ChangeClientTeam(client, CS_TEAM_T); - allGood = true; - } - i++; - } - if (!allGood) - { - i = 0; - while (!allGood && i < sizeof(authorised)) - { - if (!strcmp(authorised[i], clientId, false)) + if (!strcmp(teamCT[i], clientId, false)) { + ChangeClientTeam(client, CS_TEAM_CT); + allGood = true; + } + else if (!strcmp(teamT[i], clientId, false)) + { + ChangeClientTeam(client, CS_TEAM_T); allGood = true; - ChangeClientTeam(client, CS_TEAM_SPECTATOR); } i++; } @@ -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); }