rendered paste body if(strcmp(cmd, "/why", true) == 0){
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "GEBRUIK: /why [playerName]");
return 1;
}
//format(string, sizeof(string), "[why] %d %s", playerid, tmp);
//AddEcho(string);
new File:gFile = fopen("kblog.txt", io_read);
new line[256];
new count = 0;
format(string, sizeof(string), "Usernotes of %s:", tmp);
SendClientMessage(playerid, COLOR_YELLOW, string);
new why_what[256];
new why_date[256];
new why_by[256];
new why_reason[256];
while(fread(gFile, line, 256)) {
//AddEcho(line);
if (count == 5) {
return 1;
}
format(string, sizeof(string), "%s ::", tmp);
if (strfind(line,string,true) != -1) {
why_what = strtok(line, idx);
why_what = strreplace("[", "", why_what);
why_what = strreplace("]", "", why_what);
format(why_date, sizeof(why_date), "%s %s", strtok(line, idx), strtok(line, idx));
why_by = strtok(line, idx);
tmp = strtok(line, idx);
why_reason = strtok(line, idx);
why_reason = strrest(line, idx);
format(string, sizeof(string), "%s %s: %s (%s)", why_date, why_what, why_reason, why_by);
SendClientMessage(playerid, COLOR_WHITE, string);
count++;
}
}
if (count == 0) {
format(string, sizeof(string), "No usernotes found for %s.", tmp);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}