hi,
I had this idea but have no idea how to implement it basicly I run a fun server and people like to spam spells I dont really mind so much its kinda fun but it seems when they spam bit too hard the server crashes.
what i would like is some sort of limiter similar to what is used when you try and spam too many lines of text in chat, it says You can speak again in %u seconds..
is there a way to edit the core and add this kind of feature to the spell casting so if someone casts a spell quickly too many time it would say something like "you have casted too many times and must wait 20 sec"
Kind of like the flood protector for chat
can anyone help? its a c++ edit
below is the code used for the flood protection for chat, can it somehow be used for spell casting too?
Code:
// Flood protection
if(lang != -1 && !GetPermissionCount() && sWorld.flood_lines != 0)
{
/* flood detection, wheeee! */
if(UNIXTIME >= floodTime)
{
floodLines = 0;
floodTime = UNIXTIME + sWorld.flood_seconds;
}
if((++floodLines) > sWorld.flood_lines)
{
if(sWorld.flood_message)
_player->BroadcastMessage("Your message has triggered serverside flood protection. You can speak again in %u seconds.", floodTime - UNIXTIME);
return;
thanks
Z