Okay, so, I was thinking of a simple way to add a ban, to a html file.
I know it isn't correct, ( I TRIED ) and wanted to make something like this...
PAWNO opens the file "hash.html", and replaces the section with <head> to <head><text>BlaBla was banned by BlaBla</text></head>
Tried every kind of code, even thought of PAWNO finding the <!CODE> string into the hash.html and then add under it the text, tried with strreplace, and with DINI examples. Couldn't do it.
This is a kind of code I thought of, tested but don't works.
The ban command is this ( I KNOW ITS PRIMITIVE ) :
else if(strcmp(cmd,"ban",true) == 0)
{
if(IsPlayerAdmin(playerid))
{
new plr,snick[256];
tmp = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp), snick = strtok(cmdtext,idx);
if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED,"USAGE: /c ban [Nick/ID][Reason]");
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
else {
Ban(plr);
new str[256];
format(str,sizeof(str),"ADMIN [%s] banned [%s]. Reason [%s]",gPlayers[playerid],gPlayers[plr],cmdtext[strlen(snick)+1]);
SendClientMessageToAll(COLOR_WHITE,str);
SendClientMessage(plr,COLOR_RED,"You have been banned from this server...");
new string[256];
new year=0,month=0,day=0;
new Hour,Minute,Second;
getdate(year,month,day);
gettime(Hour,Minute,Second);
/* format(string,sizeof(string),"\r\n%s was banned by Admin %s on %d.%d.%d at %d:%d:%d with the reason: %s",gPlayers[plr],gPlayers[playerid],day,month,year,Hour,Minute,Second,cmdtext[strlen(snick)+1]);*/
/*new File:file3,File:file8,File:file4,data[256];
file2 = fopen("Server/hash.html",io_append);
//file3 = fopen("Server/hash.PART",io_write);
new io[256]; format(io,256,"<head>%s",string);
strreplace("<head>",io,io);*/
format(string,sizeof(string),"\r\n%s was banned by Admin %s on %d.%d.%d at %d:%d:%d with the reason: %s",gPlayers[plr],gPlayers[playerid],day,month,year,Hour,Minute,Second,cmdtext[strlen(snick)+1]);
new /*File:file3,*/File:file2,/*,File:file4,*/data[256];
file2 = fopen("Server/hash.html",io_append);
//file3 = fopen("Server/hash.PART",io_write);
while(fread(file2,data)) {
if(strcmp(data, "<!CODE>", true) == 1)
{
break;
new io[256]; format(io,256,"%s\r\n",string);
strreplace("<!CODE>",string,io);
fwrite(file2,"<!CODE>");
}
}
fclose(file2);
}
}
return 1;
}