Jump to content
  • 0

Cum fac sa mearga ban pe ip?


Abramovic

Question

Am o problema.. cand dau ban pe ip baneaza clasa.. si apoi nu mai intra toti cei cu acea clasa.

Am acest script.

[pawn]stock RangeBan(playerid)

{

new string[128];

    if(!IsPlayerConnected(playerid))  return 0;

    new total[32],ip[32];

    GetPlayerIp(playerid, ip, sizeof(ip));

    new cnt;

    for(new i=0;i<strlen(ip);i++)

    {

        if(ip == '.') cnt++;

        if(cnt == 2)

        {

            i++;

            strdel(ip, i, strlen(ip));

            format(total,sizeof(total),"%s*.*",ip);

        }

    }

    format(string, sizeof(string),"banip %s",total);

    SendRconCommand(string);

  SendRconCommand("reloadbans");

    return 1;

}[/pawn]

Cum fac sa baneze corect si sa intre si restu de jucatori ? Un exemplu de script ar fi bun.. banuiesc ca nu e greu.

Multumesc celor care raspund si incearca sa ma ajute! x10 Thanks!

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

Eu am comanda asta..

COMMAND:ban(playerid, params[])

{

  new text[128],targetid,string[256],sendername[MAX_PLAYER_NAME],giveplayer[MAX_PLAYER_NAME];

  if(sscanf(params, "us[128]", targetid, text)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /ban [playerid] [reason]");

  else

  {

      if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");

      if(!AdminUser(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to create a admin user, /admincreate.");

      if(GetPVarInt(playerid, "AdminLogged") == 0) return SendClientMessage(playerid, COLOR_GREY, "You need to login into your admin account, /adminlogin.");

      if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "You cannot do this to yourself.");

      if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "This player is not connected !");

      if(GetPVarInt(targetid, "Admin") == 10) return SendClientMessage(playerid, COLOR_GREY, "Can't do this to a Lead Admin.");

      if(IsPlayerNPC(targetid)) return SendClientMessage(playerid, COLOR_GREY, "Can't do this to a NPC.");

      if(strlen(text) >= 100) return SendClientMessage(playerid, COLOR_WHITE, "Ban Reason is too long.");

      if(GetPVarInt(playerid, "Admin") >= 2)

      {

            format(sendername, sizeof(sendername), "%s", AdminName(playerid));

            format(giveplayer, sizeof(giveplayer), "%s", PlayerName(targetid));

            GiveNameSpace(sendername);

            GiveNameSpace(giveplayer);

            if(GetPVarInt(playerid, "AHide") == 1 || GetPVarInt(playerid, "Admin") >= 11) sendername = "Hidden";

            format(string, sizeof(string), "AdmCmd: %s was banned by Admin %s Reason:[%s].", giveplayer, sendername, text);

        SendClientMessageToAll(COLOR_LIGHTRED, string);

        BanLog(string);

        format(string, sizeof(string), "IP: %s | Host: %s", PrintPlayerIP(targetid), PlayerInfo[targetid][pHost]);

        SendAdminAndRegMessage(COLOR_YELLOW,string);

        SetPVarInt(targetid, "Banned", 1);

        strmid(PlayerInfo[playerid][pLBannedBy], text, 0, strlen(PlayerInfo[playerid][pAdmName]), 255);

        SetPVarInt(targetid, "Bans", GetPVarInt(targetid, "Bans")+1);

        BanExtra(targetid,text,sendername);

      }

      else SendClientMessage(playerid, COLOR_LIGHTRED, "You do not have access to this command !");

  }

  return 1;

}

Link to comment
Share on other sites

Eu am comanda asta..

COMMAND:ban(playerid, params[])

{

  new text[128],targetid,string[256],sendername[MAX_PLAYER_NAME],giveplayer[MAX_PLAYER_NAME];

  if(sscanf(params, "us[128]", targetid, text)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /ban [playerid] [reason]");

  else

  {

      if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");

      if(!AdminUser(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to create a admin user, /admincreate.");

      if(GetPVarInt(playerid, "AdminLogged") == 0) return SendClientMessage(playerid, COLOR_GREY, "You need to login into your admin account, /adminlogin.");

      if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "You cannot do this to yourself.");

      if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "This player is not connected !");

      if(GetPVarInt(targetid, "Admin") == 10) return SendClientMessage(playerid, COLOR_GREY, "Can't do this to a Lead Admin.");

      if(IsPlayerNPC(targetid)) return SendClientMessage(playerid, COLOR_GREY, "Can't do this to a NPC.");

      if(strlen(text) >= 100) return SendClientMessage(playerid, COLOR_WHITE, "Ban Reason is too long.");

      if(GetPVarInt(playerid, "Admin") >= 2)

      {

            format(sendername, sizeof(sendername), "%s", AdminName(playerid));

            format(giveplayer, sizeof(giveplayer), "%s", PlayerName(targetid));

            GiveNameSpace(sendername);

            GiveNameSpace(giveplayer);

            if(GetPVarInt(playerid, "AHide") == 1 || GetPVarInt(playerid, "Admin") >= 11) sendername = "Hidden";

            format(string, sizeof(string), "AdmCmd: %s was banned by Admin %s Reason:[%s].", giveplayer, sendername, text);

        SendClientMessageToAll(COLOR_LIGHTRED, string);

        BanLog(string);

        format(string, sizeof(string), "IP: %s | Host: %s", PrintPlayerIP(targetid), PlayerInfo[targetid][pHost]);

        SendAdminAndRegMessage(COLOR_YELLOW,string);

        SetPVarInt(targetid, "Banned", 1);

        strmid(PlayerInfo[playerid][pLBannedBy], text, 0, strlen(PlayerInfo[playerid][pAdmName]), 255);

        SetPVarInt(targetid, "Bans", GetPVarInt(targetid, "Bans")+1);

        BanExtra(targetid,text,sendername);

      }

      else SendClientMessage(playerid, COLOR_LIGHTRED, "You do not have access to this command !");

  }

  return 1;

}

Degeaba iai dat tu comanda.. .. ca o sa ii apara warning si nu o sa stie sa le faca .

Link to comment
Share on other sites

Eu am comanda asta..

COMMAND:ban(playerid, params[])

{

  new text[128],targetid,string[256],sendername[MAX_PLAYER_NAME],giveplayer[MAX_PLAYER_NAME];

  if(sscanf(params, "us[128]", targetid, text)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /ban [playerid] [reason]");

  else

  {

      if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");

      if(!AdminUser(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to create a admin user, /admincreate.");

      if(GetPVarInt(playerid, "AdminLogged") == 0) return SendClientMessage(playerid, COLOR_GREY, "You need to login into your admin account, /adminlogin.");

      if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "You cannot do this to yourself.");

      if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "This player is not connected !");

      if(GetPVarInt(targetid, "Admin") == 10) return SendClientMessage(playerid, COLOR_GREY, "Can't do this to a Lead Admin.");

      if(IsPlayerNPC(targetid)) return SendClientMessage(playerid, COLOR_GREY, "Can't do this to a NPC.");

      if(strlen(text) >= 100) return SendClientMessage(playerid, COLOR_WHITE, "Ban Reason is too long.");

      if(GetPVarInt(playerid, "Admin") >= 2)

      {

            format(sendername, sizeof(sendername), "%s", AdminName(playerid));

            format(giveplayer, sizeof(giveplayer), "%s", PlayerName(targetid));

            GiveNameSpace(sendername);

            GiveNameSpace(giveplayer);

            if(GetPVarInt(playerid, "AHide") == 1 || GetPVarInt(playerid, "Admin") >= 11) sendername = "Hidden";

            format(string, sizeof(string), "AdmCmd: %s was banned by Admin %s Reason:[%s].", giveplayer, sendername, text);

        SendClientMessageToAll(COLOR_LIGHTRED, string);

        BanLog(string);

        format(string, sizeof(string), "IP: %s | Host: %s", PrintPlayerIP(targetid), PlayerInfo[targetid][pHost]);

        SendAdminAndRegMessage(COLOR_YELLOW,string);

        SetPVarInt(targetid, "Banned", 1);

        strmid(PlayerInfo[playerid][pLBannedBy], text, 0, strlen(PlayerInfo[playerid][pAdmName]), 255);

        SetPVarInt(targetid, "Bans", GetPVarInt(targetid, "Bans")+1);

        BanExtra(targetid,text,sendername);

      }

      else SendClientMessage(playerid, COLOR_LIGHTRED, "You do not have access to this command !");

  }

  return 1;

}

BanExtra(targetid,text,sendername); Ce contine functia asta ?

Are legatura cu ban pe ip ?

Link to comment
Share on other sites

Pai daca ii dau ban pe un ip dinamic(locatie sa zicem Constanta) EX: 22.333.44.444 Si daca un jucator intra(din constanta) si are 22.333.xx.xxx nu il baneaza si pe el ?

Aici nu inteleg eu .. cel cu ip dinamic scapa ? E inutil ban pe ip pentru cei cu ip dinamic?(daia folosesc functia)

Cel cu ip fix stiu ca ia ban corect, dar cel cu ip dinamic?

10x Thanks celui care imi explica!

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.