GameServer()->ClientsMaskExcludeClientVersionAndHigher(VERSION_DDNET_NEW_HUD)
excludes clients that have the new hud (16010 or higher)nload
to look at the amount of traffic but you seem to have those numbers already. Then I can recommend capturing one attack with tcpdump -w attack.pcap
let that running for a short time during the attack then ctrl+c it. This is something you can then analyse after the fact. Then as fokko pointed out check your cpu usage. If your game server it self has cpu spikes and there is lags in game but your ssh is still smooth, then iptables will help. Or maybe even changing your game server code. You can try attaching a profiler and identify where the most cpu time is spent during an attack. There might be some way to change the code to make it more efficient.nftables uses mostly the same Netfilter infrastructure as legacy iptables
hash -someargumentIdontrememberRTFM
c++
int str_check_special_chars(const char *pStr)
{
while(*pStr)
{
if (!((*pStr >= 'a' && *pStr <= 'z') || (*pStr >= 'A' && *pStr <= 'Z') || (*pStr >= '0' && *pStr <= '9')))
return 0;
pStr++;
}
return 1;
}
c++
int str_check_special_chars(const char *pStr)
{
while(*pStr)
{
if (!((*pStr >= 'a' && *pStr <= 'z') || (*pStr >= 'A' && *pStr <= 'Z') || (*pStr >= '0' && *pStr <= '9')))
return 0;
pStr++;
}
return 1;
}
c++
if (str_check_special_chars(aUsername) == 0)
{
pSelf->SendChatTarget(pResult->m_ClientID, "Your username can only consist of letters and numbers");
return;
}
std::string in, out;
std::copy_if (in.begin(), in.end(), std::back_inserter(out), [](char c) {
return std::isalnum(c);
});
c++
int str_check_special_chars(const char *pStr)
{
while(*pStr)
{
if (!((*pStr >= 'a' && *pStr <= 'z') || (*pStr >= 'A' && *pStr <= 'Z') || (*pStr >= '0' && *pStr <= '9')))
return 0;
pStr++;
}
return 1;
}
char abuff[1001];
str_format(abuff, sizeof(abuff),
c++
int str_check_special_chars(const char *pStr)
{
while(*pStr)
{
if (!((*pStr >= 'a' && *pStr <= 'z') || (*pStr >= 'A' && *pStr <= 'Z') || (*pStr >= '0' && *pStr <= '9')))
return 0;
pStr++;
}
return 1;
}
isalpha
?if(!Storage()->FolderExists("Accounts", IStorage::TYPE_SAVE))
{
Storage()->CreateFolder("Accounts", IStorage::TYPE_SAVE);
}
(edited)[127/135] Linking CXX executable DDNet-Server.exe
FAILED: DDNet-Server.exe
cmd.exe /C "cd . && C:\msys64\ucrt64\bin\c++.exe -O3 -DNDEBUG @CMakeFiles\game-server.rsp -o DDNet-
Server.exe -Wl,--out-implib,libDDNet-Server.dll.a -Wl,--major-image-version,0,--minor-image-version,
0 && cd ."
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
CMakeFiles/game-server.dir/src/game/server/ddracechat.cpp.obj:ddracechat.cpp:(.text+0x54a3): undefi
ned reference to `SkyB::IsStandardString(char const*)'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
CMakeFiles/game-server.dir/src/game/server/ddracechat.cpp.obj:ddracechat.cpp:(.text+0x55a2): undefi
ned reference to `SkyB::IsStandardString(char const*)'
collect2.exe: error: ld returned 1 exit status
[134/135] Building CXX object CMakeFiles/game-client.dir/src/game/editor/editor.cpp.obj
ninja: build stopped: subcommand failed.
undefined reference to SkyB::IsStandardString(char const*)
#ifndef SKYBLOCK_VALUES_H
#define SKYBLOCK_VALUES_H
//I put all of my values and functions here
namespace SkyB
{
bool IsStandardString(const char *pStr);
}
(edited)#include "values.h"
bool SkyB::IsStandardString(const char *pStr)
{
while(*pStr)
{
if (!((*pStr >= 'a' && *pStr <= 'z') || (*pStr >= 'A' && *pStr <= 'Z') || (*pStr >= '0' && *pStr <= '9')))
return false;
pStr++;
}
return true;
}
(edited)#pragma once
at the top of ur file #pragma once
#ifndef SKYBLOCK_VALUES_H
#define SKYBLOCK_VALUES_H
your code
#endif // SKYBLOCK_VALUES_H
#pragma once
class CCharacter;
That way the compiler can resolve thatchar abuff[2][100];
isn't abuff is a pointer to a pointer ? (edited)abuff
the same way as (&abuff[0])
abuff
absolutely isn't a pointerchar abuff[2][100];
isn't abuff is a pointer to a pointer ? (edited)int a;
int b[2];
a
by writing &a
. you can get a pointer to the first element of b
by writing b
or by writing (&b[0])
b
instead of (&b[0])
mostly makes it harder for beginnerschar
(bad example, it's a reserved keyword), then the C compiler turns it into &char[0]
(edited)char
(bad example, it's a reserved keyword), then the C compiler turns it into &char[0]
(edited)char abuff[2][100];
so this is a pointer to a pointer abuff ? which is gonna be &abuff[0][0] ? (edited)char **SkyB::GetUserDirPath()
{
IStorage *storage;
char abuff[2][100];
storage->GetCompletePath(IStorage::TYPE_SAVE, abuff[0], abuff[1], 100);
return abuff;
}
char **SkyB::GetUserDirPath()
{
IStorage *storage;
char abuff[2][100];
storage->GetCompletePath(IStorage::TYPE_SAVE, abuff[0], abuff[1], 100);
return abuff;
}
char abuff[10][10][10][100];
they are all pointers except the last 100 chars, am i right ?char abuff[10][10][10][100];
they are all pointers except the last 100 chars, am i right ? char abuff[10][10][10][100];
they are all pointers except the last 100 chars, am i right ? abuff
, in some situations "decay"s to a poinger to the first element because it's an arrayabuff
is used in some expressions. In those situations the array "turns into" a pointer to it's first elementchar abuff[10][10]
. You declared 10 arrays of arrays of 10 charactersabuff
into a function for example, it will "decay"/"turn into" a pointer to it's first elementerror: cannot call member function 'virtual void IStorage::GetCompletePath(int, const char*, char*, unsigned int)' witho
ut object
CMakeFiles/game-server.dir/src/game/server/ddracechat.cpp.obj:ddracechat.cpp:(.bss+0x0): multiple d
efinition of `SkyB::myint
it's not just ddracechat.cpp, it's on everywhere i included my header (values.h)
and this i my header:
#ifndef SKYBLOCK_VALUES_H
#define SKYBLOCK_VALUES_H
//I put all of my values and functions here
namespace SkyB
{
static constexpr unsigned int MAXIMUM_USERNAME_LENGTH = 120;
static constexpr unsigned int MAXIMUM_PASSWORD_LENGTH = 120;
static constexpr unsigned int MINIMUM_USERNAME_LENGTH = 6;
static constexpr unsigned int MINIMUM_PASSWORD_LENGTH = 6;
int myint;
bool IsStandardString(const char *pStr);
char *GetUserDirPath();
}
#endif //SKYBLOCK_VALUES_H
if i remove
int myint;
it's working again just fine, i don't know why this happeningCMakeFiles/game-server.dir/src/game/server/ddracechat.cpp.obj:ddracechat.cpp:(.bss+0x0): multiple d
efinition of `SkyB::myint
it's not just ddracechat.cpp, it's on everywhere i included my header (values.h)
and this i my header:
#ifndef SKYBLOCK_VALUES_H
#define SKYBLOCK_VALUES_H
//I put all of my values and functions here
namespace SkyB
{
static constexpr unsigned int MAXIMUM_USERNAME_LENGTH = 120;
static constexpr unsigned int MAXIMUM_PASSWORD_LENGTH = 120;
static constexpr unsigned int MINIMUM_USERNAME_LENGTH = 6;
static constexpr unsigned int MINIMUM_PASSWORD_LENGTH = 6;
int myint;
bool IsStandardString(const char *pStr);
char *GetUserDirPath();
}
#endif //SKYBLOCK_VALUES_H
if i remove
int myint;
it's working again just fine, i don't know why this happening CMakeFiles/game-server.dir/src/game/server/ddracechat.cpp.obj:ddracechat.cpp:(.bss+0x0): multiple d
efinition of `SkyB::myint
it's not just ddracechat.cpp, it's on everywhere i included my header (values.h)
and this i my header:
#ifndef SKYBLOCK_VALUES_H
#define SKYBLOCK_VALUES_H
//I put all of my values and functions here
namespace SkyB
{
static constexpr unsigned int MAXIMUM_USERNAME_LENGTH = 120;
static constexpr unsigned int MAXIMUM_PASSWORD_LENGTH = 120;
static constexpr unsigned int MINIMUM_USERNAME_LENGTH = 6;
static constexpr unsigned int MINIMUM_PASSWORD_LENGTH = 6;
int myint;
bool IsStandardString(const char *pStr);
char *GetUserDirPath();
}
#endif //SKYBLOCK_VALUES_H
if i remove
int myint;
it's working again just fine, i don't know why this happening std::numeric_limits
instead of INT_MIN
and INT_MAX
.