more code cleanup

This commit is contained in:
2019-11-02 15:06:14 +01:00
parent 4e648e21c4
commit 7842375220
5 changed files with 39 additions and 40 deletions

View File

@@ -11,14 +11,13 @@
public void ClientName(const client,char[] buf,buflen){
new String:name[DEFAULT_LEN];
if(IsClientConnected(client)){
GetClientName(client,name,DEFAULT_LEN);
GetClientName(client, name, DEFAULT_LEN);
/* get fucked if you use my seperators in your name */
ReplaceString(name,DEFAULT_LEN,",","$");
ReplaceString(name,DEFAULT_LEN,"|","&");
ReplaceString(name,DEFAULT_LEN,"0x42","0x21");
ReplaceString(name, DEFAULT_LEN,",","$");
ReplaceString(name, DEFAULT_LEN,"|","&");
ReplaceString(name, DEFAULT_LEN,"0x42","0x21");
}
//return name;
}
public void ClientID(int client, char[] buf, int buflen){
@@ -34,31 +33,31 @@ public void ActiveClients(char[] prefix, char[] buf, buflen){
new String:strCliName[DEFAULT_LEN];
ClientID(i, strCliID, DEFAULT_LEN);
ClientName(i, strCliName, DEFAULT_LEN);
Format(str_tmp, ACTIVE_CLIENTS_LENGTH,"%s|%s|%s|%d,", str_tmp, strCliID, strCliName, GetClientTeam(i));
Format(str_tmp, ACTIVE_CLIENTS_LENGTH,
"%s|%s|%s|%d,", str_tmp, strCliID, strCliName, GetClientTeam(i));
}
Format(str_tmp, ACTIVE_CLIENTS_LENGTH,"%s%s",prefix,str_tmp);
Format(str_tmp, ACTIVE_CLIENTS_LENGTH, "%s%s", prefix,str_tmp);
}
public void LogActiveClients(Handle:logfile, char[] prefix){
char strActiveClients[ACTIVE_CLIENTS_LENGTH];
ActiveClients(prefix, strActiveClients, ACTIVE_CLIENTS_LENGTH);
LogToOpenFile(logfile,strActiveClients);
LogToOpenFile(logfile, strActiveClients);
}
public void LogClientEventFormat(Handle:logfile, Handle:event, char[] prefix){
char strClientEvent[2*DEFAULT_LEN];
ClientEventFormat(event,prefix, strClientEvent, 2*DEFAULT_LEN);
LogToOpenFile(logfile,strClientEvent);
ClientEventFormat(event, prefix, strClientEvent, 2*DEFAULT_LEN);
LogToOpenFile(logfile, strClientEvent);
}
public void ClientEventFormat(Handle:event, char[] prefix, char[] buf, buflen){
new client = GetClientOfUserId(GetEventInt(event, "userid"));
char team[4];
Format(team,sizeof(team),"%d",GetClientTeam(client));
Format(team, sizeof(team), "%d", GetClientTeam(client));
char tmp[DEFAULT_LEN*2];
char strCliID[DEFAULT_LEN];
ClientID(client, strCliID, DEFAULT_LEN);
Format(tmp, 2*DEFAULT_LEN, "%s%s,%s", prefix, strCliID, team);
}