SA-MP Forums Archive
if someone types a ip they get kicked? - 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: if someone types a ip they get kicked? (/showthread.php?tid=156458)



if someone types a ip they get kicked? - Kar - 22.06.2010

^i dont understand how to make the ip part help<.<


Re: if someone types a ip they get kicked? - Niixie - 22.06.2010

Search, i know theres alot of people asking for that


Re: if someone types a ip they get kicked? - Kar - 22.06.2010

i found this
Код:
stock CountOccurrence(text[],ch) {
	new count = 0;
	for(new i=0;i<strlen(text);i++) {
		if (text[i] == ch) count++;
	}
	return count;
}

Script_OnPlayerText(playerid, text[]) {
	if(CountOccurrence(text,'.')>2 && CountOccurrence(text,':')>1) {
 		if(!IsPlayerAdmin(playerid)) {
 		  SendClientMessage(playerid,0xFF0000AA,"Error: We do not allow the posting of IP addresses here");
 		  Kick(playerid);
			return 0;
		}
	}
    return 1;
Код:
C:\DOCUME~1\Karim\MYDOCU~1\GRANDT~1\SA-MPS~1\GAMEMO~1\COPSAN~1.PWN(1456) : warning 203: symbol is never used: "Script_OnPlayerText"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.

ingore loose ident


Re: if someone types a ip they get kicked? - Finn - 22.06.2010

Try using the correct callback, OnPlayerText.


Re: if someone types a ip they get kicked? - iggy1 - 22.06.2010

Looks like that code is ysi, silly question are you using ysi? if not use
pawn Код:
stock CountOccurrence(text[],ch) {
    new count = 0;
    for(new i=0;i<strlen(text);i++) {
        if (text[i] == ch) count++;
    }
    return count;
}

public OnPlayerText(playerid, text[]) {
    if(CountOccurrence(text,'.')>2 && CountOccurrence(text,':')>1) {
        if(!IsPlayerAdmin(playerid)) {
          SendClientMessage(playerid,0xFF0000AA,"Error: We do not allow the posting of IP addresses here");
          Kick(playerid);
            return 0;
        }
    }
    return 1;
that should not give that error if u r not using ysi


Re: if someone types a ip they get kicked? - Kar - 22.06.2010

typed in my ip prefectly

72.51.79.182

nothing happened

wtf why is there isplayeradmin in there for?


Re: if someone types a ip they get kicked? - Jefff - 22.06.2010

Admin can type IP but player not
Quote:
Originally Posted by Kar
typed in my ip prefectly

72.51.79.182

nothing happened

wtf why is there isplayeradmin in there for?
type port too 72.51.79.182:7777
or type "..." xD


Re: if someone types a ip they get kicked? - Joe_ - 22.06.2010

What if I type

Hi guys. I'm new. My name's Joe. (: So what do I need to do?

I'd be kicked lol




Re: if someone types a ip they get kicked? - iggy1 - 22.06.2010

Not got a clue why its not working, its checking if a player isnt admin, so admin can type ip's without getting kicked sorry cant help more , ps u need to put the port too like :7777


Re: if someone types a ip they get kicked? - Antonio [G-RP] - 22.06.2010

Shouldn't it be..

if(CountOccurrence(text,'.')>3 && CountOccurrence(text,':')>1) {

So if you type 65.56.55:6666 you wont get kicked? (only 3 dots)