|
楼主 |
发表于 2010-9-12 10:13:26
|
显示全部楼层
来自 中国–福建–厦门
*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#define PLUGIN "Reallite Files Checker"
#define VERSION "0.5"
#define AUTHOR "DJ_WEST"
static const s_FilesUrl[] = "www.reallite.cs2.ru"
static const s_Reason[] = "Please use only standart files"
new g_FilesUrl
new g_Reason
new g_Enable
new g_Admin
new g_CheckMaps
new g_CheckTextures
new g_CheckModels
new g_CheckSprites
new g_CheckSound
new g_CheckExe
new g_CheckOpengl32
public plugin_init()
{
new s_ConfigsDir[128], s_ChecksFile[128]
get_configsdir(s_ConfigsDir, sizeof(s_ConfigsDir)-1)
format (s_ChecksFile, sizeof(s_ChecksFile)-1, "%s/reallite_fc_main.cfg", s_ConfigsDir)
if (file_exists (s_ChecksFile))
server_cmd("exec %s", s_ChecksFile)
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("rfc_version", VERSION, FCVAR_SERVER)
register_dictionary ("reallite_fc.txt")
g_FilesUrl = register_cvar("rfc_filesurl", s_FilesUrl)
g_Reason = register_cvar("rfc_reason", s_Reason)
g_Enable = register_cvar("rfc_enable", "1")
g_Admin = register_cvar("rfc_admin", "1")
g_CheckMaps = register_cvar("rfc_maps", "1")
g_CheckTextures = register_cvar("rfc_textures", "1")
g_CheckModels = register_cvar("rfc_models", "1")
g_CheckSprites = register_cvar("rfc_sprites", "1")
g_CheckSound = register_cvar("rfc_sounds", "1")
g_CheckExe = register_cvar("rfc_exe", "1")
g_CheckOpengl32 = register_cvar("rfc_opengl32", "1")
}
public plugin_precache()
{
register_forward (FM_PrecacheModel, "File_Precache")
register_forward (FM_PrecacheSound, "File_Precache")
register_forward (FM_PrecacheGeneric, "File_Precache")
new s_ConfigsDir[64], s_ChecksFile[96]
get_configsdir(s_ConfigsDir, sizeof(s_ConfigsDir)-1)
new s_MapName[32], s_MapFile[64]
get_mapname(s_MapName, sizeof(s_MapName)-1)
format (s_MapFile, sizeof(s_MapFile)-1, "maps/%s.bsp", s_MapName)
Enforce(s_MapFile)
format(s_ChecksFile, sizeof(s_ChecksFile)-1, "%s/reallite_fc.cfg", s_ConfigsDir)
if (!file_exists (s_ChecksFile))
log_amx ("ERROR: %s doesn't exist.", s_ChecksFile)
else
{
new s_RFCText[64]
new a, i_Position = 0
while (read_file(s_ChecksFile, i_Position++, s_RFCText, 63, a))
{
if (s_RFCText[0] != ';' && !equal(s_RFCText, ""))
Enforce(s_RFCText)
}
}
}
public File_Precache(const s_File[])
{
Enforce(s_File)
return FMRES_IGNORED
}
public Enforce(const s_File[])
{
new s_FileWav[64]
format (s_FileWav, sizeof(s_FileWav)-1, "sound/%s", s_File)
if (file_exists(s_File))
force_unmodified(force_exactfile, {0,0,0}, {0,0,0}, s_File)
else if (file_exists(s_FileWav))
force_unmodified(force_exactfile, {0,0,0}, {0,0,0}, s_File)
}
public inconsistent_file(id, const s_FileName[], s_KickReason[64])
{
new s_Name[32], s_AuthID[32], s_IP[32], i_UserID, s_FilesUrl[128], s_NewFileName[64], s_Reason[64]
get_user_authid(id, s_AuthID, sizeof(s_AuthID)-1)
get_user_ip(id, s_IP, sizeof(s_IP)-1)
get_user_name(id, s_Name, sizeof(s_Name)-1)
i_UserID = get_user_userid(id)
get_pcvar_string(g_FilesUrl, s_FilesUrl, sizeof(s_FilesUrl)-1)
get_pcvar_string(g_Reason, s_Reason, sizeof(s_Reason)-1)
if (!(get_pcvar_num(g_Admin) == 1))
if ((get_user_flags(id) & ADMIN_IMMUNITY)) return PLUGIN_HANDLED
if (!(get_pcvar_num(g_CheckMaps) == 1) && (containi(s_FileName, ".bsp") != -1))
return PLUGIN_HANDLED
if (!(get_pcvar_num(g_CheckTextures) == 1) && (containi(s_FileName, ".wad") != -1))
return PLUGIN_HANDLED
if (!(get_pcvar_num(g_CheckModels) == 1) && (containi(s_FileName, ".mdl") != -1))
return PLUGIN_HANDLED
if (!(get_pcvar_num(g_CheckSprites) == 1) && (containi(s_FileName, ".spr") != -1))
return PLUGIN_HANDLED
if (!(get_pcvar_num(g_CheckSound) == 1) && (containi(s_FileName, ".wav") != -1))
return PLUGIN_HANDLED
if (!(get_pcvar_num(g_CheckOpengl32) == 1) && (containi(s_FileName, ".dll") != -1))
return PLUGIN_HANDLED
if (!(get_pcvar_num(g_CheckExe) == 1) && (containi(s_FileName, ".exe") != -1))
return PLUGIN_HANDLED
if(containi(s_FileName, ".wav") != -1)
format(s_NewFileName, 64, "sound/%s", s_FileName)
else
format(s_NewFileName, 64, "%s", s_FileName)
format(s_KickReason, sizeof(s_KickReason)-1, "%s. %s.^n", s_NewFileName, s_Reason)
log_to_file("reallite_fc.txt","[Reallite Files Checker %s]: ^"%s<%d><%s><%s>^" has not standart file ^"%s^"", VERSION, s_Name, i_UserID, s_AuthID, s_IP, s_NewFileName)
client_cmd(id, "echo ^"==================================^"")
client_cmd(id, "echo ^"[Reallite Files Checker %s]: %L^"", VERSION, id, "RFC_INFO_5", s_NewFileName)
client_cmd(id, "echo ^"[Reallite Files Checker %s]: %L %s^"", VERSION, id, "RFC_INFO_4", s_FilesUrl)
client_cmd(id, "echo ^"==================================^"")
Message(s_Name, s_NewFileName)
return get_pcvar_num(g_Enable) ? PLUGIN_CONTINUE : PLUGIN_HANDLED
}
public client_connect(id)
{
new s_FilesUrl[128]
get_cvar_string("rfc_filesurl", s_FilesUrl, sizeof(s_FilesUrl)-1)
client_cmd(id, "echo ^"=======================================================^"")
client_cmd(id, "echo ^"* %L %s^"", id, "RFC_INFO_1", VERSION)
client_cmd(id, "echo ^"* %L^"", id, "RFC_INFO_2")
client_cmd(id, "echo ^"* %L^"", id, "RFC_INFO_3")
client_cmd(id, "echo ^"* %L %s^"", id, "RFC_INFO_4", s_FilesUrl)
client_cmd(id, "echo ^"=======================================================^"")
}
public Message(s_Name[], s_File[])
{
new s_Message[128], s_Team[12]
format(s_Message, sizeof(s_Message)-1, "^x03Reallite Files Checker %s [ ^x04%s - %s^x03 ]", VERSION, s_Name, s_File)
new s_Players[32], i_Num
get_players(s_Players, i_Num)
new id
for (id = 0; id < i_Num; id++)
{
get_user_team(s_Players[id], s_Team, sizeof(s_Team)-1)
message_begin(MSG_ONE, get_user_msgid("TeamInfo"), {0,0,0}, s_Players[id])
write_byte(s_Players[id])
write_string("TERRORIST")
message_end()
message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0},s_Players[id])
write_byte(s_Players[id])
write_string(s_Message)
message_end()
message_begin(MSG_ONE, get_user_msgid("TeamInfo"), {0,0,0}, s_Players[id])
write_byte(s_Players[id])
write_string(s_Team)
message_end()
}
return PLUGIN_HANDLED
} |
|