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

48
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,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);
}