hlmod.hu
https://hlmod.hu/

Káromkodás szűrő kicsillagozással
https://hlmod.hu/viewtopic.php?f=9&t=2064
Oldal: 1 / 1

Szerző:  Silverss [2010.11.02. 20:52 ]
Hozzászólás témája:  Káromkodás szűrő kicsillagozással

Sziasztok!
Ha valakinek van olyan káromkodás szűrője ami csak kicsillagozza azt az egy szót ami a tiltólistán van, nagyon megköszönném ha a forráskódját bemásolná ide nekem.

Szerző:  KeXxX [2010.11.02. 21:27 ]
Hozzászólás témája:  Re: Káromkodás szűrő kicsillagozással

Szia!
Talán ez..
Kód:
#include <amxmodx>
#include <amxmisc>

// max number of words in word list
#define MAX_WORDS 192

new g_swearsNames[MAX_WORDS][32]
new g_swearsNum

public plugin_init()
{
   register_plugin("Swear Filter","1.0a","SuicideDog")
   register_clcmd("say","swearcheck")
   register_clcmd("say_team","swearcheck")
   readList()
}

readList()
{
    // file to read words from
   new szCustomDir[64]
   new filename[64]
   get_customdir( szCustomDir, 63 )
   format(filename, 63, "%s/swear/swearwords.ini", szCustomDir )

   if(!file_exists(filename) ){
      log_message("Swear Filter: file %s not found", filename)
      return
   }
   new iLen
   while( g_swearsNum < MAX_WORDS && read_file(filename, g_swearsNum ,g_swearsNames[g_swearsNum][1],30,iLen) )
   {
   if( g_swearsNames[g_swearsNum][0] == ';') continue
   g_swearsNames[g_swearsNum][0] = iLen
   ++g_swearsNum
   }
   log_message("Swear Filter: loaded %d words",g_swearsNum )
}

public swearcheck(id)
{
   new szSaid[192]
   read_args(szSaid,191)
   new bool:found = false
   new pos, i = 0
   while ( i < g_swearsNum )
   {
   if ( (pos = containi(szSaid,g_swearsNames[i][1])) != -1 ){
      new len = g_swearsNames[i][0]
      while(len--)
      szSaid[pos++] = '*'
      found = true
      continue
   }
   ++i
   }
   if ( found ){
      new cmd[32]
      read_argv(0,cmd,31)         
      engclient_cmd(id,cmd,szSaid)   
   }
   return PLUGIN_CONTINUE
}

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/