diff --git a/infolan.sp b/infolan.sp index 40688a6..67adf82 100644 --- a/infolan.sp +++ b/infolan.sp @@ -31,7 +31,8 @@ public Plugin myinfo = public void OnPluginStart() { 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); RegServerCmd("!team", SetTeam); @@ -43,6 +44,12 @@ public void OnPluginStart() 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) { @@ -211,13 +218,8 @@ public void SocketUpdateScore(Handle socket, any arg) { char requestStr[1024]; char json[64]; - char nomTeamDeux[150]; - char nomTeamUn[150]; - 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(json, sizeof(json), "{\"port\": %d, \"ct\": %d, \"t\": %d}", + port, CS_GetTeamScore(CS_TEAM_CT), CS_GetTeamScore(CS_TEAM_T)); FormatEx( requestStr, sizeof(requestStr),