SA-MP Forums Archive
Range Banning! Help please. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Range Banning! Help please. (/showthread.php?tid=118873)



Range Banning! Help please. - introzen - 05.01.2010

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 =)


Re: Range Banning! Help please. - introzen - 05.01.2010

Anyone who knows how to solve?


Re: Range Banning! Help please. - GTAguillaume - 05.01.2010

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];



Re: Range Banning! Help please. - Cueball - 06.01.2010

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

~Cueball~



Re: Range Banning! Help please. - introzen - 06.01.2010

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? =/


Re: Range Banning! Help please. - introzen - 06.01.2010

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")
=/


Re: Range Banning! Help please. - introzen - 06.01.2010

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


Re: Range Banning! Help please. - [HiC]TheKiller - 06.01.2010

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.


Re: Range Banning! Help please. - introzen - 06.01.2010

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...


Re: Range Banning! Help please. - dice7 - 06.01.2010

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