19.05.2010, 00:16
Quote:
Originally Posted by cAMo
Is it too demanding for a server to INSERT every line of chat into a MySQL database for logging purposes?
Yes / No? Ideas? |
EDIT:
Here's a little flood protection i whipped up, its pretty simple.
Код:
#include <a_samp> #define MAX_WARNINGS 5 //warnings before a kick #define CHAT_LIMIT 5 //seconds before they can send another message enum E_FLOOD { Tick, Warnings } new AntiSpam[MAX_PLAYERS][E_FLOOD], String[128]; public OnFilterScriptInit() { print("\n**************************************"); print("--------------------------------------"); print("| Kyoshiro's AntiSpam Loaded!! |"); print("--------------------------------------"); print("**************************************\n"); } public OnPlayerText(playerid, text[]) { if(GetTickCount() - AntiSpam[playerid][Tick] <= CHAT_LIMIT * 1000) { new seconds = CHAT_LIMIT-(GetTickCount() - AntiSpam[playerid][Tick])/1000; format(String, sizeof(String), "Please wait %d %s to talk! Warning %d of %d!!",seconds,(seconds==1)?("second"):("seconds"),AntiSpam[playerid][Warnings]+1, MAX_WARNINGS); SendClientMessage(playerid,0xFF0000FF,String); AntiSpam[playerid][Warnings]++; if(AntiSpam[playerid][Warnings] >= MAX_WARNINGS) { SendClientMessage(playerid, 0xFF0000FF, "You were kicked for flooding the chat!!"); Kick(playerid); } return 0; } AntiSpam[playerid][Tick] = GetTickCount(), AntiSpam[playerid][Warnings] = 0; return 1; }