#define IP_LIMIT 3 // = Max connections from one single IP
#define Time_Limit 3500 // = The time span between connects, adjust it to your own specifications
public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid)) {
new server_IP[16];
format(server_IP, 16, "127.0.0.1");
if(strcmp(ConnIP,server_IP,true) != 0) {
Ban(playerid); // Ban is the safest thing here, as if you kick, they can still flood you with endless connections
return 0;
}
}
return 1;
}
The attack I am experiencing doesn't trigger the OnPlayerConnect function. It blocks my server somehow, and the players who are trying to connect afterwards, all have the same IP : 255.255.255.255 (this is a gateway in fact) and they all have the same -1 ping. Can your include stop that?
|
Err, RyDeR's one is MUCH more efficient and effective.
About the NPC's. Use the maxnpc limit in server.cfg, should fix your problem. |
I've seen RyDeR's just after I posted this one, and I believe it's quite the same. This was tested with actual attacks on some of our servers and it has proved itself to be trustworthy and reliable, so I don't see how RyDeR's one would be MUCH more efficient and effective. But hey, I released my own version in which I trust and so did he, both indeed do work, now it's up to the crowd who they choose to trust.
Once again this is fully working and it's been tested about 3-4 times in an actual server attack, and I can say that the attackers were pretty much owned. About the maxnpc limit, that wouldn't solve his problem since I believe he has a endless loop in his OnPlayerConnect, that's why I'm asking for the code. |
BOT ATTACK has joined. Random Player has joined. BOT ATTACK has joined. BOT ATTACK has joined. Random Player has joined. BOT ATTACK has joined. etc. |
Basicly, your server has low player count. RyDeR's one creates a,lets say, database. We store the latest 50 IP's, while yours stores the last one. See the difference?
RyDeR's code would detect this one, and your's wouldn't. I hope you got the point. |
public OnPlayerConnect(playerid) { GameTextForPlayer(playerid,"censored",5000,5); Pspawned[playerid] = 0; firstspawn[playerid]=1; GPSTimer[playerid] = 0; ClickedPlayerID[playerid] = -1; HaveGPS[playerid] = false; SendPlayerFormattedText(playerid, "Welcome to cenzoredt, for more please type /help and /tour", 0); SendClientMessage(playerid,0xB360FDFF,"Use /house to find information on our houses"); SendClientMessage(playerid, COLOR_LIGHTBLUE,"Type /cmds for all commands (really)!"); SendClientMessage(playerid, COLOR_ULTRARED,"Use /ro if you are romвn or /eng if you are English."); SendClientMessage(playerid, COLOR_YELLOW,"Type /teles to see teleportation on the server "); SendClientMessage(playerid, COLOR_ORANGERED,"If you need a vehicle type /V and if you want to tune cars write /tune"); TextDrawShowForPlayer(playerid, Textdraw0); TextDrawShowForPlayer(playerid, Textdraw1); TextDrawShowForPlayer(playerid, Textdraw2); TextDrawShowForPlayer(playerid, Textdraw3); TogglePlayerControllable(playerid, false); TextDrawShowForPlayer(playerid, TheBoxy); TextDrawShowForPlayer(playerid, Hin); TextDrawShowForPlayer(playerid, Weilcome); TextDrawShowForPlayer(playerid, thelp); TextDrawShowForPlayer(playerid, ttele); TextDrawShowForPlayer(playerid, trules); TextDrawShowForPlayer(playerid, byFarsek); TextDrawShowForPlayer(playerid, Commings); TextDrawShowForPlayer(playerid, Enjoyit); TextDrawShowForPlayer(playerid, tcmds); SetPlayerHealth(playerid,100); ResetPlayerWeapons(playerid); gActivePlayers[playerid]++; gLastGaveCash[playerid] = GetTickCount(); GetPlayerName(playerid, pname, sizeof(pname)); format(oyunism, sizeof(oyunism), "/Saver/%s.ini",pname); if(!dini_Exists(oyunism)) { dini_Create(oyunism); dini_IntSet(oyunism, "Score", 0); dini_IntSet(oyunism, "Money", 0); SetPlayerScore(playerid, dini_Int(oyunism, "Score")); SetPlayerMoney(playerid, dini_Int(oyunism, "Money")); } else { SetPlayerScore(playerid, dini_Int(oyunism, "Score")); SetPlayerMoney(playerid, dini_Int(oyunism, "Money")); } return 1; }
My onplayerconnect function looks like this....maybe with other textdraws and connect messages.
But it's not triggered because that thing doesn't fully connect like a normal player. Check this topic, I posted my problem there and a guy posted a video with the exact thing that is happening to me (he posted 2 videos. The second video shows what is also happening to me) I also posted there a pic with the rcon window of the server that shows the anomaly . Код:
public OnPlayerConnect(playerid) { GameTextForPlayer(playerid,"~r~Romania~w~Super~g~Stunt",5000,5); Pspawned[playerid] = 0; firstspawn[playerid]=1; GPSTimer[playerid] = 0; ClickedPlayerID[playerid] = -1; HaveGPS[playerid] = false; SendPlayerFormattedText(playerid, "Welcome to Romania Super Stunt[OFFICIAL]t, for more please type /help and /tour", 0); SendClientMessage(playerid,0xB360FDFF,"Use /house to find information on our houses"); SendClientMessage(playerid, COLOR_LIGHTBLUE,"Type /cmds for all commands (really)!"); SendClientMessage(playerid, COLOR_ULTRARED,"Use /ro if you are romвn or /eng if you are English."); SendClientMessage(playerid, COLOR_YELLOW,"Type /teles to see teleportation on the server "); SendClientMessage(playerid, COLOR_ORANGERED,"If you need a vehicle type /V and if you want to tune cars write /tune"); TextDrawShowForPlayer(playerid, Textdraw0); TextDrawShowForPlayer(playerid, Textdraw1); TextDrawShowForPlayer(playerid, Textdraw2); TextDrawShowForPlayer(playerid, Textdraw3); TogglePlayerControllable(playerid, false); TextDrawShowForPlayer(playerid, TheBoxy); TextDrawShowForPlayer(playerid, Hin); TextDrawShowForPlayer(playerid, Weilcome); TextDrawShowForPlayer(playerid, thelp); TextDrawShowForPlayer(playerid, ttele); TextDrawShowForPlayer(playerid, trules); TextDrawShowForPlayer(playerid, byFarsek); TextDrawShowForPlayer(playerid, Commings); TextDrawShowForPlayer(playerid, Enjoyit); TextDrawShowForPlayer(playerid, tcmds); SetPlayerHealth(playerid,100); ResetPlayerWeapons(playerid); gActivePlayers[playerid]++; gLastGaveCash[playerid] = GetTickCount(); GetPlayerName(playerid, pname, sizeof(pname)); format(oyunism, sizeof(oyunism), "/Saver/%s.ini",pname); if(!dini_Exists(oyunism)) { dini_Create(oyunism); dini_IntSet(oyunism, "Score", 0); dini_IntSet(oyunism, "Money", 0); SetPlayerScore(playerid, dini_Int(oyunism, "Score")); SetPlayerMoney(playerid, dini_Int(oyunism, "Money")); } else { SetPlayerScore(playerid, dini_Int(oyunism, "Score")); SetPlayerMoney(playerid, dini_Int(oyunism, "Money")); } return 1; } |
Ok thank you, I will seek help there. It's less likely to find it, but I hope they solve this in the next RC, just like they did with the fake players tool. Again, thank you very much.
|