View Single Post
mrmiki
Junior Member
Join Date: Mar 2021
Old 05-31-2021 , 22:45   Re: only teamates show in menu
Reply With Quote #3

tnq its solved <3

also i need another help
i want to save teams scores to a txt file at the end of the match
like ct score :16 | t score : 14
also if it could save players kills and deaths and mvp and headshots

i know it is very big request but i couldnt find or create any



HTML Code:
#pragma semicolon 1
#include <sourcemod>
#include <cstrike>
#include <sdktools>
static String:chatFile[128];
new Handle:fileHandle       = INVALID_HANDLE;


public void OnPluginStart() {
    HookEvent("cs_intermission", Event_MapEnd);
    
    
    new String:date[21];
    new String:logFile[100];
    FormatTime(date, sizeof(date), "%d%m%y", -1);
    Format(logFile, sizeof(logFile), "/data/scores%s.txt", date);
    BuildPath(Path_SM, chatFile, PLATFORM_MAX_PATH, logFile);
}

public OnMapStart(){
	new String:map[128];
	new String:msg[1024];
	new String:date[21];
	new String:time[21];
	new String:logFile[100];

	GetCurrentMap(map, sizeof(map));

	/* The date may have rolled over, so update the logfile name here */
	FormatTime(date, sizeof(date), "%d%m%y", -1);
	Format(logFile, sizeof(logFile), "/logs/chat%s.log", date);
	BuildPath(Path_SM, chatFile, PLATFORM_MAX_PATH, logFile);

	FormatTime(time, sizeof(time), "%d/%m/%Y %H:%M:%S", -1);
	Format(msg, sizeof(msg), "[%s] --- NEW MAP STARTED: %s ---", time, map);

	SaveMessage("--=================================================================--");
	SaveMessage(msg);
	SaveMessage("--=================================================================--");
}

public Action Event_MapEnd(Event event, const char[] name, bool dontBroadcast) 
{
	new String:msg[1024];
	int scorect = CS_GetTeamScore(CS_TEAM_CT);
	int scoret = CS_GetTeamScore(CS_TEAM_T);
	
	
	Format(msg, sizeof(msg), "Team CT: score %s | Team T: score %s", scorect, scoret);
	
	SaveMessage(msg);

}

public SaveMessage(const String:message[])
{
	fileHandle = OpenFile(chatFile, "a");  /* Append */
	WriteFileLine(fileHandle, message);
	CloseHandle(fileHandle);
}
mrmiki is offline