Scripting with ip - 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)
+--- Thread: Scripting with ip (
/showthread.php?tid=515715)
Scripting with ip -
AroseKhanNiazi - 27.05.2014
how can i get that player has typed an ip
Re: Scripting with ip -
YoungKris - 27.05.2014
There is no actual proper detection but you can use
https://sampwiki.blast.hk/wiki/Strfind under OnPlayerText or OnPlayerCommandText to search for 3 full stops and a colon?
Re: Scripting with ip -
driftpower - 27.05.2014
don't allow more than 1 dot heh
Re: Scripting with ip -
R0 - 27.05.2014
well,not allowing more than 1 dot wont be good,it would be a failure,lets say 2 players are chatting,and one of them said a sentence and used ..... instead of completing it he would be counted as ip sharing so,when i am back home i will make the code for you
Re: Scripting with ip -
Vince - 27.05.2014
Regex plugin would be the most accurate method.
Re: Scripting with ip -
AroseKhanNiazi - 27.05.2014
Quote:
Originally Posted by R0
well,not allowing more than 1 dot wont be good,it would be a failure,lets say 2 players are chatting,and one of them said a sentence and used ..... instead of completing it he would be counted as ip sharing so,when i am back home i will make the code for you
|
thanks bro

waiting for it
Quote:
Originally Posted by Vince
Regex plugin would be the most accurate method.
|
can u give link for it
Re: Scripting with ip -
Koala818 - 27.05.2014
https://sampforum.blast.hk/showthread.php?tid=247893
If you'll search the topic you'll even find a regex expression for detecting an ip.
Quote:
Originally Posted by Fro1sha
This version faster =)
pawn Код:
stock ContainsIPEx(const string[]) { static RegEx:rCIP ; if ( !rCIP ) { rCIP = regex_build("(.*?)([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})(.*?)"); } return regex_match_exid(string, rCIP); }
|
But be aware that if a player types for example 10.000.000.000 this function will detect it.
Re: Scripting with ip -
AroseKhanNiazi - 27.05.2014
thanks but how can i use this to get the ip ??
Re: Scripting with ip -
Koala818 - 27.05.2014
pawn Код:
public OnPlayerText(playerid, text[])
{
if(ContainsIPEx(text)) SendClientMessage(playerid, -1, "Don't write ip addresses on chat.");
else SendClientMessageToAll(-1, text);
return 0;
}
Just an idea. If you understand how regex works you can do more.