1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-02-20 19:57:12 +01:00

Add extra validation when assigning a player name.

This commit is contained in:
Sandu Liviu Catalin 2016-08-27 04:03:24 +03:00
parent 77184fd9fb
commit f9c2c879c4

View File

@ -344,10 +344,20 @@ void CPlayer::SetName(CSStr name) const
// Validate the managed identifier
Validate();
// Perform the requested operation
if (_Func->SetPlayerName(m_ID, name) == vcmpErrorInvalidName)
const vcmpError ret = _Func->SetPlayerName(m_ID, name);
// Validate the resulted status
if (ret == vcmpErrorNullArgument)
{
STHROWF("Cannot assign a null name to a player");
}
else if (ret == vcmpErrorInvalidName)
{
STHROWF("The specified name is invalid");
}
else if (ret == vcmpErrorTooLargeInput)
{
STHROWF("The specified name is too large");
}
}
// ------------------------------------------------------------------------------------------------