Jump to content
  • 0

Problema ban offline


Alexutzuuu23

Question

Problema intalnita (descriere): Am incercat sa fac o comanda de ban offline,nu am nici-o eroare dar nu da ban...adica folosesc comanda si player-ul nu este banat.
Ero(area / rile) / warning-(ul / urile):
Liniile de cod / sursa / script-ul(obligatoriu): 

if(strcmp(cmd, "/banoff", true) == 0)
   {
       if(IsPlayerConnected(playerid))
       {
          tmp = strtok(cmdtext, idx);
         if(!strlen(tmp))
         {
            SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}Folosire{FFFFFF}: /banoff [Numele Contului] [Motiv]");
            return 1;
         }
         if (PlayerInfo[playerid][pAdmin] >= 5 )
         {

            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
               idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
               result[idx - offset] = cmdtext[idx];
               idx++;
            }
             result[idx - offset] = EOS;
            if(!strlen(result))
            {
               SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}Folosire{FFFFFF}: /banoff [Numele Contului] [Motiv]");
               return 1;
            }
            format(string, sizeof(string), "users/%s.ini", tmp);
            if ( !fexist ( string ) )
               return SendClientMessage ( playerid, -1, "* Nu exista un jucator cu acel nume ." );
            strreplace ( string, "Locked=0\n", "Locked=1\n" );
            new year, month,day;
            getdate(year, month, day);
            format(string, sizeof(string), "[Zi: %d | Luna: %d | An:%d]%s(offline) a fost banat de catre %s.Motiv:, %s.", day,month,year, tmp, sendername, (result));
            BanLog(string);
            format(string, sizeof(string), "AdmCmd: %s(offline) a fost banat de catre %s.Motiv: %s", tmp, sendername, (result));
            ABroadCast(COLOR_LIGHTRED,string,1);
         }
         else
         {
            format(string, sizeof(string), "Nu ai acces sa utilizezi aceasta camanda", giveplayerid);
            SendClientMessage(playerid, COLOR_GRAD1, string);
         }
      }
      return 1;
   }
Imagini / Video (optional):
Ati incercat sa rezolvati singur?: Da
Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 1

Ai #include  <Dini>   ? :\

 

EDIT daca iti da eraorea aia inseamna ca nu ai acest stock in includeul dini

Pune asta undeva in gm

stock dini_IntSet(filename[],key[],value) {
   new valuestring[DINI_MAX_STRING];
   format(valuestring,DINI_MAX_STRING,"%d",value);
   return dini_Set(filename,key,valuestring);
}

Edited by Mister

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 1

Pune asta la onplayerconnect si modifica in ea cu variabilele tale sau cum vrei tu:

Modifica asta  "Users/%s.ini "  pentru ca tu ai un folder diferit unde se salveaza conturile

 

new PlayerFile[50];
    new banname[213];
    GetPlayerName(playerid, banname, sizeof banname);
   	format(PlayerFile, sizeof(PlayerFile), "Users/%s.ini", banname);
   	if(dini_Int(PlayerFile,"Locked") != 0)
   	{
        SendClientMessage(playerid,COLOR_NICERED,"===================================Login de pe cont Banat ======================================");
		SendClientMessage(playerid,0x1196EEC8,"Acest nume este banat pe server, pana acum nu ai primit unban.");
		SendClientMessage(playerid,0x1196EEC8,"Daca ai fost neindreptatit poti face cerere de unban pe forum: http://forum.sa-mp.ro");
		SendClientMessage(playerid,0x1196EEC8,"Daca banul a fost corect nu te obosi sa faci cerere");
		SendClientMessage(playerid,COLOR_NICERED,"=======================================BAN INFORMATION==========================================");
    	SetTimerEx("kicker", 2000, false, "i", playerid);
	}
	// asta o pui undeva la sfarsitul gm-ului
	forward kicker(playerid);
	public kicker(playerid)
	{
	    Kick(playerid);
	    return 1;
	}

 

Edited by Mister
  • Upvote 1

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0

Salut incearca sa adaugi asta

       		dini_IntSet(string,"Locked",1);

In locul acesteaia pe care o ai tu

strreplace ( string, "Locked=0\n", "Locked=1\n" );

Adica inlocuiesti

Ar trebui sa arate asa:

 

 

 

	if(strcmp(cmd, "/banoff", true) == 0)
   {
       if(IsPlayerConnected(playerid))
       {
          tmp = strtok(cmdtext, idx);
         if(!strlen(tmp))
         {
            SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}Folosire{FFFFFF}: /banoff [Numele Contului] [Motiv]");
            return 1;
         }
         if (PlayerInfo[playerid][pAdmin] >= 5 )
         {

            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
               idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
               result[idx - offset] = cmdtext[idx];
               idx++;
            }
             result[idx - offset] = EOS;
            if(!strlen(result))
            {
               SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}Folosire{FFFFFF}: /banoff [Numele Contului] [Motiv]");
               return 1;
            }
            format(string, sizeof(string), "users/%s.ini", tmp);
            if ( !fexist ( string ) )
               return SendClientMessage ( playerid, -1, "* Nu exista un jucator cu acel nume ." );
       		dini_IntSet(string,"Locked",0);
            
            new year, month,day;
            getdate(year, month, day);
            format(string, sizeof(string), "[Zi: %d | Luna: %d | An:%d]%s(offline) a fost banat de catre %s.Motiv:, %s.", day,month,year, tmp, sendername, (result));
            BanLog(string);
            format(string, sizeof(string), "AdmCmd: %s(offline) a fost banat de catre %s.Motiv: %s", tmp, sendername, (result));
            ABroadCast(COLOR_LIGHTRED,string,1);
         }
         else
         {
            format(string, sizeof(string), "Nu ai acces sa utilizezi aceasta camanda", giveplayerid);
            SendClientMessage(playerid, COLOR_GRAD1, string);
         }
      }
      return 1;
   }

 

 

 

EDIT: am pus gresit 

dini_IntSet(string,"Locked",0);

Trebuia sa pun 1, pentru ca tu ai playerul banat cu 1, deci pune asa

dini_IntSet(string,"Locked",1);
Edited by Mister

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0

Salut incearca sa adaugi asta

       		dini_IntSet(string,"Locked",1);

In locul acesteaia pe care o ai tu

strreplace ( string, "Locked=0\n", "Locked=1\n" );

Adica inlocuiesti

Ar trebui sa arate asa:

 

 

Hidden Content

 

 

EDIT: am pus gresit 

dini_IntSet(string,"Locked",0);

Trebuia sa pun 1, pentru ca tu ai playerul banat cu 1, deci pune asa

dini_IntSet(string,"Locked",1);

Am rezolvat cu erorile dar comanda nu baneaza jucatorul..adica poate intra in joc dar nu ii mai merge parola

Edited by Alexutzuuu23
Modificari
Link to comment
Share on other sites

  • 0

Trebuia sa pui cum ai tu variabila, deasta nu iti mai merge acum parola variabila ta era asa

Locked=1\n

eu am pus fara \n  si acum nu ti-a mers.

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.