Anti Advertisement not 100 % help please
#1

this is example code
stock AdvertisementCheck(string[])
{
if(!strfind(string,"www.",false))
{
return true;
}
return false;
}

public OnPlayerText(playerid, text[])
{
if(AdvertisementCheck(text))
{
PlayerInfo[playerid][pLocked] = 1;
Kick(playerid);
return 0;
}

when i said www. (Kicked)
when i said awww. (Not Kicked)
when i said (Space)www. (Not Kicked)
when i said aaaaawww. (not kicked)
when i said (Space)(Space) or (Space)(Space)(Space)www. (Not Kicked)

how to detect all word ?
Reply
#2

Try this at OnPlayerText:
Код:
public OnPlayerText(playerid, text[])
{
for(new a = 0; a < strlen(text); a++)
{
  if(AdvertisementCheck(text[a]))
 {

   PlayerInfo[playerid][pLocked] = 1;
   Kick(playerid);
   return 0;
}
 }
Reply
#3

i will try . thank you man !
Reply
#4

now ooc

if(strcmp(cmd, "/ooc", true) == 0 || strcmp(cmd, "/o", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " ¤ШіВС§дБидґйЕзНЎНФ№ !");
return 1;
}
if ((noooc) && PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " ГРєє OOC ¶ЩЎ»ФґвґВбНґБФ№ !");
return 1;
}
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, " ¤ШідБиКТБТГ¶ѕЩґдґй, аѕГТР¤Шіа»з№гєй !");
return 1;
}
if(MsgSend[playerid] == 1)
{
SendClientMessage(playerid, 0x00ffffff, " НВиТїЕСґ¤ГСє !");
MsgSend[playerid] = 1;
SetTimerEx("UnMute",2000,0,"d",playerid);
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/o)oc [ooc chat]");
return 1;
}
if(AdvertisementCheck(result) && PlayerInfo[playerid][pAdmin] < 1)
{
PlayerInfo[playerid][pLocked] = 1;
Kick(playerid);
return 1;
}
format(string, sizeof(string), "[OOC] %s ѕЩґЗиТ: %s " , sendername, result);
OOCOff(COLOR_WHITE,string);
MsgSend[playerid] = 1;
SetTimerEx("UnMute",2000,0,"d",playerid);
printf("%s", string);
}
return 1;
}

i said (/o aaawww. ) is not Kicked
Reply
#5

Код:
if(!strfind(string,"www.",false))
{
to
Код:
if(strfind(string,"www.",true)!=-1) 
{
Reply
#6

Quote:
Originally Posted by Jefff
Код:
if(!strfind(string,"www.",false))
{
to
Код:
if(strfind(string,"www.",true)!=-1) 
{
if i say everything Kicked .

how to detect Word,(Space),About !@#$(%^)&**(++! and Number ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)