1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Manually identify stream target.

This commit is contained in:
Sandu Liviu Catalin 2021-03-21 11:01:22 +02:00
parent f5e766ab7b
commit 2cbc450285

View File

@ -2248,8 +2248,14 @@ struct LgStream {
Write(value.mPtr, length); Write(value.mPtr, length);
} }
} }
static void SendStream(LgPlayer * player) { static void SendStream(LightObj & target) {
_Func->SendClientScriptData(player != nullptr ? player->GetIdentifier() : -1, m_OutputStreamData, m_OutputStreamEnd); int32_t id;
if (target.IsNull()) id = -1;
else if (target.GetType() == OT_INTEGER || target.GetType() == OT_FLOAT) id = target.Cast< int32_t >();
else if (static_cast< AbstractStaticClassData * >(target.GetTypeTag()) == StaticClassTypeTag< LgPlayer >::Get()) {
id = target.CastI< LgPlayer >()->GetIdentifier();
} else STHROWF("Invalid target");
_Func->SendClientScriptData(id, m_OutputStreamData, m_OutputStreamEnd);
ClearOutput(); ClearOutput();
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------