Changement nom équipe socket

This commit is contained in:
rick 2021-05-29 03:15:03 +02:00
parent e0ac191d3f
commit cb1b3e259f
Signed by: Rick
GPG key ID: 2B593F087240EE99

View file

@ -31,7 +31,8 @@ public Plugin myinfo =
public void OnPluginStart() public void OnPluginStart()
{ {
HookEvent("player_activate", SetTeamPlayer); HookEvent("player_activate", SetTeamPlayer);
HookEvent("cs_win_panel_round", UpdateScoreBoard); //HookEvent("cs_win_panel_round", UpdateScoreBoard);
HookEvent("cs_win_panel_match", FinCarte);
//HookEvent("cs_match_end_restart", TestRestart, EventHookMode_Pre); //HookEvent("cs_match_end_restart", TestRestart, EventHookMode_Pre);
RegServerCmd("!team", SetTeam); RegServerCmd("!team", SetTeam);
@ -43,6 +44,12 @@ public void OnPluginStart()
PrintToServer("Hello world!"); PrintToServer("Hello world!");
} }
public void FindCarte()
{
ServeurLibre();
Handle socket = SocketCreate(SOCKET_TCP, OnSocketError);
SocketConnect(socket, SocketUpdateScore, OnSocketReceive, OnSocketDisconnected, MY_SOCKET_IP, MY_SOCKET_PORT);
}
public void TestRestart(Event event, const char[] name, bool dontBroadcast) public void TestRestart(Event event, const char[] name, bool dontBroadcast)
{ {
@ -211,13 +218,8 @@ public void SocketUpdateScore(Handle socket, any arg)
{ {
char requestStr[1024]; char requestStr[1024];
char json[64]; char json[64];
char nomTeamDeux[150]; FormatEx(json, sizeof(json), "{\"port\": %d, \"ct\": %d, \"t\": %d}",
char nomTeamUn[150]; port, CS_GetTeamScore(CS_TEAM_CT), CS_GetTeamScore(CS_TEAM_T));
GetTeamName(CS_TEAM_CT, nomTeamUn, sizeof(nomTeamUn));
GetTeamName(CS_TEAM_T, nomTeamDeux, sizeof(nomTeamDeux));
FormatEx(json, sizeof(json), "{\"port\": %d, \"%s\": %d, \"%s\": %d}",
port, nomTeamUn, CS_GetTeamScore(CS_TEAM_CT),
nomTeamDeux, CS_GetTeamScore(CS_TEAM_T));
FormatEx( FormatEx(
requestStr, requestStr,
sizeof(requestStr), sizeof(requestStr),