March 29, 2024, 02:44:50 pm

Author Topic: [PAWN - I know you hate it] Heh, PAWNO + HTML workaround ?  (Read 1738 times)

0 Members and 1 Guest are viewing this topic.

Shadow

  • Guest
[PAWN - I know you hate it] Heh, PAWNO + HTML workaround ?
« on: January 14, 2012, 05:56:09 pm »
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 ) :

Code: [Select]
    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;
}
« Last Edit: January 14, 2012, 06:04:22 pm by Shadow »
Cannot rate own posts


stormeus

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 1755
  • Country: us
  • VC:MP Developer
    • View Profile
    • GTA VICE CITY Respective owner
Re: [PAWN - I know you hate it] Heh, PAWNO + HTML workaround ?
« Reply #1 on: January 14, 2012, 05:58:08 pm »
Use Squirrel and the XML libraries to accomplish this. Trying to do this in Pawn will cause nothing but grief.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

<krystianoo> stormeus do good job
<krystianoo> with recent update
<krystianoo> if not agree; jeb yourself in head
<Avenger> yesterday you said death to stormeus
<karan> double standard krystianoo
<karan> he called him fake prophet too
<krystianoo> sure fake prophet
<krystianoo> but with recent updates real

Shadow

  • Guest
Re: [PAWN - I know you hate it] Heh, PAWNO + HTML workaround ?
« Reply #2 on: January 14, 2012, 06:46:45 pm »
I just noticed I cannot even copy the file. Results another blank file..
Now, serious, any workaround ?
Cannot rate own posts


Zeke

  • Crazy Man
  • *****
  • Posts: 935
  • Country: bg
  • VC:MP and LU beta tester
    • View Profile
Re: [PAWN - I know you hate it] Heh, PAWNO + HTML workaround ?
« Reply #3 on: January 14, 2012, 06:51:59 pm »
Leave Pawn and do what Storme said.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

Quote
InstallHook(0x405AC0,(DWORD)CantFindFuckingAnim,0x405A95,
CantFindFuckingAnim_HookJmpCode,sizeof(CantFindFuckingAnim_HookJmpCode));
-------------------------------------------------
Quote
[00:41:12] <~Murdock> actually just transfering files
[00:41:16] <~Murdock> sounds, clientscripts etc
[00:42:05] <heekzs> what transfer method you uses
[00:43:03] <~Murdock> speed of light