replace ip in chat - 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: replace ip in chat (
/showthread.php?tid=395597)
replace ip in chat -
mastermax7777 - 26.11.2012
how to find ip in chat and replace it with my own ip?
so like player types 123.12.12.1424:7777 for advertisment and i want it replaced with my server ip.. like in crazybobs server when u type an ip u know it replaces with their own?
how can i put it in onplayerText? just for fun im curious i dont want to delete the whole message just the ip part..
Re: replace ip in chat -
NumbSkull - 27.11.2012
pawn Код:
if(strfind(text, ":", true) != -1)
{
new
i_numcount,
i_period,
i_pos;
while(text[i_pos]) {
if('0' <= text[i_pos] <= '9') i_numcount++;
else if(text[i_pos] == '.') i_period++;
i_pos++;
}
if(i_numcount >= 8 && i_period >= 3) {
format(string, sizeof(string), "123.12.12.1424:7777");
ProxDetector(20.0,playerid,string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
Kick(playerid);
return 0;
}
}
under public OnPlayerText(playerid, text[]) and public public OnPlayerCommandText(playerid, cmdtext[]) **OnPlayerCommandText ver needs a little modifacation**
Re: replace ip in chat -
mastermax7777 - 27.11.2012
Quote:
Originally Posted by NumbSkull
pawn Код:
if(strfind(text, ":", true) != -1) {
new i_numcount, i_period, i_pos;
while(text[i_pos]) { if('0' <= text[i_pos] <= '9') i_numcount++; else if(text[i_pos] == '.') i_period++; i_pos++; } if(i_numcount >= 8 && i_period >= 3) { format(string, sizeof(string), "123.12.12.1424:7777"); ProxDetector(20.0,playerid,string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5); Kick(playerid); return 0; } }
under public OnPlayerText(playerid, text[]) and public public OnPlayerCommandText(playerid, cmdtext[]) **OnPlayerCommandText ver needs a little modifacation**
|
thanks
i guess that willl work... rapped+