Range Banning! Help please.
#1

Hey, I've made a Range Ban command which looks like this:
pawn Код:
dcmd_suspendrange(playerid,params[])
{
  if(PlayerInfo[playerid][pAdmin] < 2) return 1;
  new ip[128],string[128],pName[MAX_PLAYER_NAME],reason;
  if(sscanf(params,"sz",ip,reason)) return SendClientMessage(playerid,COLOR_GREY,".: Usage: /suspendrange [range (123.123.*.*)] [reason] :.");
  GetPlayerName(playerid,pName,sizeof(pName));
  format(string,sizeof(string),"..: %s BANNED Range %s. Reason: %s :..",pName,ip,reason);
  SendClientMessageToAll(COLOR_DARKRED,string);
  print(string);
  dini_IntSet("CLRP/RangeBans.ban",ip,1);
  return 1;
}
And this is supposed to check if the player is banned on connect:

pawn Код:
stock RangeBanCheck(playerid)
{
  new pIP[256];
  GetPlayerIp(playerid,pIP,sizeof(pIP));
  new pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid,pName,sizeof(pName));
  if(dini_Int("CLRP/RangeBans.ban",pIP) == 1)
  {
        new server[256];
        format(server,sizeof(server),".: Server kicked %s, RANGE BANNED! :.",pName);
        SendClientMessageToAll(COLOR_DARKRED, server);
        Kick(playerid);
    }
    return 1;
}
First of all, the /suspendrange REASON shows the first letter and then the playername who banned the range...

/imageshack/img24/567/samp003kc.png

And Second of all. When I connect to the server with my range banned, it doesn't kick me and says RANGE BANNED with big letters...


Help please =)
Reply
#2

Anyone who knows how to solve?
Reply
#3

pawn Код:
new ip[128],string[128],pName[MAX_PLAYER_NAME],reason;
reason most be a string:

pawn Код:
new ip[128],string[128],pName[MAX_PLAYER_NAME],reason[256];
Reply
#4

IP addresses are strings, not integers, so use the dini string functions instead of the integer ones.

~Cueball~
Reply
#5

Quote:
Originally Posted by Cuecumber
IP addresses are strings, not integers, so use the dini string functions instead of the integer ones.

~Cueball~
How comes it works to set the ip adress in the file with dini_IntSet then? =/
Reply
#6

pawn Код:
stock RangeBanCheck(playerid)
{
  new pIP[256];
  GetPlayerIp(playerid,pIP,sizeof(pIP));
  new pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid,pName,sizeof(pName));
  if(dini_Get("CLRP/RangeBans.ban",pIP) == 1)
  {
        new server[256];
        format(server,sizeof(server),".: Server kicked %s, Account BANNED! :.",pName);
        SendClientMessageToAll(COLOR_DARKRED, server);
        Kick(playerid);
    }
    return 1;
}
Код:
E:\Documents and Settings\IntrozeN\Desktop\SAMP Serv\gamemodes\CLRP.pwn(7207) : error 033: array must be indexed (variable "dini_Get")
=/
Reply
#7

Quote:
Originally Posted by Cuecumber
IP addresses are strings, not integers, so use the dini string functions instead of the integer ones.

~Cueball~
And dini_Int is used to check the Integer of the IP Adress.

I save the adresses like this:

127.0.0.1=1 //Banned
36.358.35.3=0 //Not Banned
Reply
#8

Quote:
Originally Posted by IntrozeN
Quote:
Originally Posted by Cuecumber
IP addresses are strings, not integers, so use the dini string functions instead of the integer ones.

~Cueball~
And dini_Int is used to check the Integer of the IP Adress.

I save the adresses like this:

127.0.0.1=1 //Banned
36.358.35.3=0 //Not Banned
A integer is a number not a number with dots. You cannot read from it, because dini_Int only finds numbers, not dots.

Quote:
Originally Posted by IntrozeN
pawn Код:
stock RangeBanCheck(playerid)
{
  new pIP[256];
  GetPlayerIp(playerid,pIP,sizeof(pIP));
  new pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid,pName,sizeof(pName));
  if(dini_Get("CLRP/RangeBans.ban",pIP) == 1)
  {
        new server[256];
        format(server,sizeof(server),".: Server kicked %s, Account BANNED! :.",pName);
        SendClientMessageToAll(COLOR_DARKRED, server);
        Kick(playerid);
    }
    return 1;
}
Код:
E:\Documents and Settings\IntrozeN\Desktop\SAMP Serv\gamemodes\CLRP.pwn(7207) : error 033: array must be indexed (variable "dini_Get")
=/
A string doesn't equal 1.

Use strcmp to compare 2 strings.
Reply
#9

Quote:
Originally Posted by [HiC
TheKiller ]
Quote:
Originally Posted by IntrozeN
Quote:
Originally Posted by Cuecumber
IP addresses are strings, not integers, so use the dini string functions instead of the integer ones.

~Cueball~
And dini_Int is used to check the Integer of the IP Adress.

I save the adresses like this:

127.0.0.1=1 //Banned
36.358.35.3=0 //Not Banned
A integer is a number not a number with dots. You cannot read from it, because dini_Int only finds numbers, not dots.

Quote:
Originally Posted by IntrozeN
pawn Код:
stock RangeBanCheck(playerid)
{
  new pIP[256];
  GetPlayerIp(playerid,pIP,sizeof(pIP));
  new pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid,pName,sizeof(pName));
  if(dini_Get("CLRP/RangeBans.ban",pIP) == 1)
  {
        new server[256];
        format(server,sizeof(server),".: Server kicked %s, Account BANNED! :.",pName);
        SendClientMessageToAll(COLOR_DARKRED, server);
        Kick(playerid);
    }
    return 1;
}
Код:
E:\Documents and Settings\IntrozeN\Desktop\SAMP Serv\gamemodes\CLRP.pwn(7207) : error 033: array must be indexed (variable "dini_Get")
=/
A string doesn't equal 1.

Use strcmp to compare 2 strings.
Used:

pawn Код:
stock RangeBanCheck(playerid)
{
  new pIP[256];
  GetPlayerIp(playerid,pIP,sizeof(pIP));
  new pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid,pName,sizeof(pName));
  if(strcmp("CLRP/RangeBans.ban",pIP) == 0)
  {
        new server[256];
        format(server,sizeof(server),".: Server kicked %s, Account BANNED! :.",pName);
        SendClientMessageToAll(COLOR_DARKRED, server);
        Kick(playerid);
    }
    return 1;
}
didn't work...
Reply
#10

Quote:
Originally Posted by [HiC
TheKiller ]
Quote:
Originally Posted by IntrozeN
Quote:
Originally Posted by Cuecumber
IP addresses are strings, not integers, so use the dini string functions instead of the integer ones.

~Cueball~
And dini_Int is used to check the Integer of the IP Adress.

I save the adresses like this:

127.0.0.1=1 //Banned
36.358.35.3=0 //Not Banned
A integer is a number not a number with dots. You cannot read from it, because dini_Int only finds numbers, not dots.

Quote:
Originally Posted by IntrozeN
pawn Код:
stock RangeBanCheck(playerid)
{
  new pIP[256];
  GetPlayerIp(playerid,pIP,sizeof(pIP));
  new pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid,pName,sizeof(pName));
  if(dini_Get("CLRP/RangeBans.ban",pIP) == 1)
  {
        new server[256];
        format(server,sizeof(server),".: Server kicked %s, Account BANNED! :.",pName);
        SendClientMessageToAll(COLOR_DARKRED, server);
        Kick(playerid);
    }
    return 1;
}
Код:
E:\Documents and Settings\IntrozeN\Desktop\SAMP Serv\gamemodes\CLRP.pwn(7207) : error 033: array must be indexed (variable "dini_Get")
=/
A string doesn't equal 1.

Use strcmp to compare 2 strings.
You don't understand. He uses the ip as the key for saving and an integer for saving banned/not banned. That's why he has dini_IntSet

Just use
pawn Код:
dini_Int("CLRP/RangeBans.ban",pIP) == 1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)