Jump to content
  • 0

Problema unban


bogdan.trial

Question

Salut, care poate sa imi explice ce am gresit eu aici, ca nu imi da unban la player.

[pawn]CMD:ban(playerid, params[])

{

new ID;

new pname[MAX_PLAYER_NAME];

new str[99];

if(PlayerInfo[playerid][pAdmin] > 0)

    {

    if(sscanf(params, "us", ID)) return SendClientMessage(playerid, COLOR_RED,"USAGE: {FFFFFF}/ban [playerid]");

    if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,COLOR_RED, "ERROR: {FFFFFF}That user is not connected!");

    GetPlayerName(ID, pname, sizeof(pname));

    if(PlayerInfo[playerid][pAdmin] < 2 && PlayerInfo[iD][pAdmin] > 1) return SendClientMessage(playerid,COLOR_RED,"ERROR: {FFFFFF}You cannot ban Administators!");

    format(str, sizeof(str), " - %s has been banned from the server.", pname);

    SendClientMessageToAll(COLOR_RED, str);

        PlayerInfo[iD][pBan] = 1;

Ban(ID);

}

    else return 0;

    return 1;

}

CMD:unban(playerid, params[])

{

new ID;

new giveplayer[MAX_PLAYER_NAME];

new sendername[MAX_PLAYER_NAME];

new string[182];

new tmp[192];

new idx;

if(PlayerInfo[playerid][pAdmin] > 0)

{

tmp = strtok(params,idx);

if(!strlen(tmp))

  {

    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [name]");

    return 1;

    }

GetPlayerName(ID, giveplayer, sizeof(giveplayer));

    GetPlayerName(playerid, sendername, sizeof(giveplayer));

    format(string, 256, "AdmWarning: %s has unbanned %s", sendername, tmp);

  SendClientMessage(playerid,COLOR_YELLOW,string);

    format(string, 256, "AdmWarning: %s has unbanned %s", sendername, tmp);

      printf(string);

      format(string,sizeof(string),"Users/%s.ini",tmp);

      PlayerInfo[iD][pBan] = 0;

      SendClientMessage(playerid, COLOR_WHITE, "Player unbanned");

      SendRconCommand(string);

      SendRconCommand("reloadbans");

    GetPlayerName(ID, giveplayer, sizeof(giveplayer));

      GetPlayerName(playerid, sendername, sizeof(sendername));

return 1;

}

return 1;

}[/pawn]

signature.php?bg=000000&text=FFFFFF&border=a0a0a0&ip=176.31.142.87&port=7777&bg_image=
Link to comment
Share on other sites

8 answers to this question

Recommended Posts

Asta inseamna ca nu mai poate sa dea ban:))

Merge si cum zice el daca pun OnPlayerConnect

[pawn] if(PlayerInfo[playerid][pBan] == 1)

    {

Kick(playerid);

SendClientMessage(playerid,COLOR_GREY, "You are banned from this server");

return 1;

}[/pawn]

Oricum nu stiu ce are , nu vrea sa imi schimbe in %s.ini Ban = 0

signature.php?bg=000000&text=FFFFFF&border=a0a0a0&ip=176.31.142.87&port=7777&bg_image=
Link to comment
Share on other sites

comanda ta de /unban e praf rau . Cum sa ii dea pBan la playerid cand playerid nu e pe server ? =))

Uite , te ajut iar :

[pawn] format(string, sizeof(string), "users/%s.ini", tmp);

  new File:hFile = fopen(string, io_read);//new File: hFile = fopen(string, io_append);

  if (hFile)

  {

      new Data[ 256 ],val [ 256 ];

  while ( fread( hFile , Data , sizeof( Data ) ) )

  if( strcmp( ini_GetKey( Data ) , "Locked" , true ) == 0 )val = ini_GetValue( Data );

  if(strval( val ) == 1)

  {

    new var[64];

  format(var, sizeof(var), "Locked=1\n");

  //fdeleteline(string,var);

  fclose(hFile);hFile = fopen(string, io_append);

  format(var, 64, "Locked=0\n");

  fwrite(hFile, var);

  fclose(hFile);[/pawn] Ti-am dat ce era important , nu iti dau tot scriptul

Link to comment
Share on other sites

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.