update(logs): ajout de logs #7

This commit is contained in:
rick 2021-06-05 18:28:05 +02:00
parent 019f828826
commit b5c092e18b
Signed by: Rick
GPG key ID: 2B593F087240EE99

View file

@ -51,6 +51,7 @@ public void OnPluginStart()
PrintToServer("Depot git: https://git.gnous.eu/Rick/infolanBot");
PrintToServer("Depot github: https://github.com/InfoLAN/infolanCSGOplugin");
PrintToServer("Licence: GPL3\n");
LogMessage("Le plugin a démarré avec succès !");
}
/**
@ -69,6 +70,7 @@ public void OnConfigsExecuted()
{
if (port < 0)
port = GetConVarInt(FindConVar("hostport"));
LogMessage("Port configuré :%d", port);
}
/**
@ -167,18 +169,21 @@ public Action SetTeam(int args)
*/
public Action AjoutJoueur(int args)
{
char tmp[128];
GetCmdArg(1, tmp, sizeof(tmp));
int team = (!strcmp(tmp, "ct", false) ? 1 : 2);
GetCmdArg(2, tmp, sizeof(tmp));
char tmp[2058];
GetCmdArgString(tmp, 2058);
LogMessage("Commande !team reçu: %s", tmp);
char arg[128];
GetCmdArg(1, arg, sizeof(arg));
int team = (!strcmp(arg, "ct", false) ? 1 : 2);
GetCmdArg(2, arg, sizeof(arg));
if (team == 1)
{
teamCT[nbJoueursCT] = tmp;
teamCT[nbJoueursCT] = arg;
nbJoueursCT++;
}
else
{
teamT[nbJoueursT] = tmp;
teamT[nbJoueursT] = arg;
nbJoueursT++;
}
}
@ -189,6 +194,7 @@ public Action AjoutJoueur(int args)
*/
public void ServeurLibre()
{
LogMessage("Envoi socket pour serveur libre.");
Handle socket = SocketCreate(SOCKET_TCP, OnSocketError);
SocketConnect(socket, SocketEnvoieVictoire, OnSocketReceive, OnSocketDisconnected, MY_SOCKET_IP, MY_SOCKET_PORT);
}
@ -198,6 +204,7 @@ public void ServeurLibre()
*/
public void UpdateScoreBoard(Event event, const char[] name, bool dontBroadcast)
{
LogMessage("Envoi socket pour maj les scores.");
Handle socket = SocketCreate(SOCKET_TCP, OnSocketError);
SocketConnect(socket, SocketUpdateScore, OnSocketReceive, OnSocketDisconnected, MY_SOCKET_IP, MY_SOCKET_PORT);
}
@ -252,7 +259,8 @@ public void OnSocketDisconnected(Handle socket, any arg)
CloseHandle(socket);
}
public void OnSocketError(Socket socket, const int errorType, const int errorNum, any hFile) {
PrintToServer("socket error %d (errno %d)", errorType, errorNum);
public void OnSocketError(Socket socket, const int errorType, const int errorNum, any hFile)
{
LogMessage("Socket error %d (errno %d)", errorType, errorNum);
CloseHandle(socket);
}