Author Topic: Anti-Advertisement - Protection for commands and chat!  (Read 1078 times)

Offline Lordz

  • Beta Tester
  • Sr. Member
  • ****
  • Posts: 1238
  • Location: Earth
    • RBTDM
Re: Anti-Advertisement - Protection for commands and chat!
« on: February 24, 2013, 12:02:30 pm »
nice
but they can adv in pm

No, I've tested it. They can't adv through Pm's if detection function is there. :)

Here's the command PM of my script
CMD:pm(playerid, params[]){ if(ServerInfo[PM] == 0) return SendClientMessage(playerid, red, "Sorry, currently PMing has been disabled by server Management!"); if(Loggedin[playerid] == 0) return SendClientMessage(playerid, red, "You must either register or login to use this command!"); new p2, msg[128]; if(sscanf(params, "rs[128]", p2, msg)) {  SendClientMessage(playerid, red, "Usage: /pm [playerid] [message]");  return SendClientMessage(playerid, orange, "Function: Will send a private message to the specified player only."); } if(p2 == INVALID_PLAYER_ID) return SendClientMessage(playerid, red, "Invalid player id!"); if(!IsPlayerConnected(p2)) return SendClientMessage(playerid, red, "This player is not connected!"); if(pm[p2] == 0) return SendClientMessage(playerid, red, "This user has disabled recieving PMs! (PMing Failed)"); if(p2 == playerid) return SendClientMessage(playerid, red, "You cannot PM yourself!"); new Lname[MAX_PLAYER_NAME], Pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, Lname, sizeof(Lname)); GetPlayerName(p2, Pname, sizeof(Pname)); new string[128]; if(DetectAdv(msg)) {  format(string, sizeof(string), "%s (ID:%d) has been kicked from the server! (Reason:Advertising via PM)", Lname, playerid);  SendClientMessageToAll(red, string);  new Hour, Min, Sec, Year, Mon, Day;  gettime(Hour, Min, Sec);  getdate(Year, Mon, Day);  new pl[16];  GetPlayerIp(playerid, pl, sizeof(pl));  new lstring[256];  format(lstring, sizeof(lstring), "%s has been kicked from the server for advertising through PMS! (Text:%s) (DATE: %d/%d/%d) (TIME: %d:%d:%d) (IP: %s)\r\n", Lname, msg, Day, Mon, Year, Hour, Min, Sec, pl);  new File:adv = fopen("/Server/Logs/Advertised.txt", io_append);  if(adv)  {   fwrite(adv, lstring);   fclose(adv);  }  return SetTimerEx("KICK", 500, false, "d", playerid); } format(string, sizeof(string), "PM from %s (ID:%d) : %s", Lname, playerid, msg); SendClientMessage(p2, yellow, string); format(string, sizeof(string), "PM to %s (ID:%d) : %s", Pname, p2, msg); SendClientMessage(playerid, grey, string); PlaySound(p2, SOUNDNOT); if(ServerInfo[Readpms] == 1) {  if(!IsPlayerAdmin(playerid))  {   if(UserInfo[playerid][Level] != MAX_LEVEL)   {    format(string, sizeof(string), "[PM] %s(%d) to %s(%d): %s", Lname, Pname, msg);    MessageAdmins(MAX_LEVEL, pink, string);   }  } } new fstr[256], Year, Mon, Day, Hour, Min, Sec; getdate(Year, Mon, Day); gettime(Hour, Min, Sec); format(fstr, sizeof(fstr), "|- %s to %s: %s -| (Date: %d/%d/%d) (Time: %d:%d:%d)\r\n", Lname, Pname, msg, Day, Mon, Year, Hour, Min, Sec); new File:pmlog = fopen(pmPath, io_append); if(pmlog) {  fwrite(pmlog, fstr);  fclose(pmlog); } new str[128]; format(str, sizeof(str), "%s : %s (%d:%d:%d)", Lname, msg, Hour, Min, Sec); for(new i = 1; i < MAX_PM-1; i++) Pms[i] = Pms[i+1]; Pms[MAX_PM-1] = str; return 1;}?>

« Last Edit: February 24, 2013, 12:17:57 pm by Lordz »