mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-22 04:37:13 +01:00
Add extra validation when assigning a player name.
This commit is contained in:
parent
77184fd9fb
commit
f9c2c879c4
@ -344,10 +344,20 @@ void CPlayer::SetName(CSStr name) const
|
|||||||
// Validate the managed identifier
|
// Validate the managed identifier
|
||||||
Validate();
|
Validate();
|
||||||
// Perform the requested operation
|
// 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");
|
STHROWF("The specified name is invalid");
|
||||||
}
|
}
|
||||||
|
else if (ret == vcmpErrorTooLargeInput)
|
||||||
|
{
|
||||||
|
STHROWF("The specified name is too large");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user