SA-MP Forums Archive
Unban problem (dini) +REP - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Unban problem (dini) +REP (/showthread.php?tid=330618)



Unban problem (dini) +REP - c0smin - 01.04.2012

Код:
if (strcmp(cmd, "/unban", true)==0)
   {
      if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 1337)
      {
         tmp = strtok(cmdtext, idx);
         if(!strlen(tmp))
         {
            SendClientMessage(playerid, 0xA8A8FFFF, "USAGE: /unban [PlayerName]");
            return 1;
         }
         format(string,sizeof(string),"%s.ini",tmp);
         if(fexist(string))
         {
             new valoare = 0;
             dini_IntSet(string, "Ban", valoare);
             GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
             GetPlayerName(playerid, sendername, sizeof(sendername));
             format(string, 256, "AdmWarning: %s has unbanned %s", sendername,tmp);
             ABroadCast(COLOR_YELLOW,string,1);
             format(string, 256, "AdmWarning: %s has unbanned %s", sendername,tmp);
             printf(string);
         }
         else
         {
             SendClientMessage(playerid, 0xFFFFFFFF, "Numele nu exista");
         }
      }
      return 1;
   }
After unban , Dini_intset work perfectly (transform Ban=1 in Ban=0 ) , but when you try to login with correct password is not functionally.
In user.ini the password it's not modified , and it's not crypted .


Re: Unban problem (dini) +REP - Daddy Yankee - 02.04.2012

That's because of the difference between the way your files are saving and the way Dini edit them, I had this problem before. You gotta change something in your Dini.inc. Look in the end, for

pawn Код:
stock DINI_fcopytextfile(oldname[],newname[]) {
    new File:ohnd,File:nhnd;
    if (!fexist(oldname)) return false;
    ohnd=fopen(oldname,io_read);
    if (!ohnd) return false;
    nhnd=fopen(newname,io_write);
    if (!nhnd) {
        fclose(ohnd);
        return false;
    }
    new tmpres[DINI_MAX_STRING];
    while (fread(ohnd,tmpres)) {
        DINI_StripNewLine(tmpres);
        format(tmpres,sizeof(tmpres),"%s\r\n",tmpres);
        fwrite(nhnd,tmpres);
    }
    fclose(ohnd);
    fclose(nhnd);
    return true;
}
and change it to
pawn Код:
stock DINI_fcopytextfile(oldname[],newname[]) {
    new File:ohnd,File:nhnd;
    if (!fexist(oldname)) return false;
    ohnd=fopen(oldname,io_read);
    if (!ohnd) return false;
    nhnd=fopen(newname,io_write);
    if (!nhnd) {
        fclose(ohnd);
        return false;
    }
    new tmpres[DINI_MAX_STRING];
    while (fread(ohnd,tmpres)) {
        DINI_StripNewLine(tmpres);
        format(tmpres,sizeof(tmpres),"%s\n",tmpres);
        fwrite(nhnd,tmpres);
    }
    fclose(ohnd);
    fclose(nhnd);
    return true;
}



Re: Unban problem (dini) +REP - c0smin - 02.04.2012

Thanks !!!!!!!! +REP