mirror of
https://github.com/hermansimensen/eventqueue-fix.git
synced 2025-12-07 10:28:25 +00:00
Fix unparsable data being sent to sourcemod.
This should fix the crashes that occoured in #10 and #8
This commit is contained in:
parent
a41d2f9d86
commit
de8fdf911b
@ -228,7 +228,8 @@ public MRESReturn DHook_AddEventThree(Handle hParams)
|
|||||||
|
|
||||||
DHookGetParamString(hParams, 1, event.target, 64);
|
DHookGetParamString(hParams, 1, event.target, 64);
|
||||||
DHookGetParamString(hParams, 2, event.targetInput, 64);
|
DHookGetParamString(hParams, 2, event.targetInput, 64);
|
||||||
DHookGetParamObjectPtrString(hParams, 3, 0, ObjectValueType_String, event.variantValue, sizeof(event.variantValue));
|
ResolveVariantValue(hParams, event);
|
||||||
|
|
||||||
int ticks = RoundToCeil((view_as<float>(DHookGetParam(hParams, 4)) - FLT_EPSILON) / GetTickInterval());
|
int ticks = RoundToCeil((view_as<float>(DHookGetParam(hParams, 4)) - FLT_EPSILON) / GetTickInterval());
|
||||||
event.delay = float(ticks);
|
event.delay = float(ticks);
|
||||||
event.caller = EntityToBCompatRef(view_as<Address>(DHookGetParam(hParams, 6)));
|
event.caller = EntityToBCompatRef(view_as<Address>(DHookGetParam(hParams, 6)));
|
||||||
@ -242,6 +243,31 @@ public MRESReturn DHook_AddEventThree(Handle hParams)
|
|||||||
return MRES_Supercede;
|
return MRES_Supercede;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ResolveVariantValue(Handle ¶ms, event_t event)
|
||||||
|
{
|
||||||
|
int type = DHookGetParamObjectPtrVar(params, 3, 16, ObjectValueType_Int);
|
||||||
|
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
float fVar = DHookGetParamObjectPtrVar(params, 3, 0, ObjectValueType_Float);
|
||||||
|
FloatToString(fVar, event.variantValue, sizeof(event.variantValue));
|
||||||
|
}
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
{
|
||||||
|
int iVar = DHookGetParamObjectPtrVar(params, 3, 0, ObjectValueType_Int);
|
||||||
|
IntToString(iVar, event.variantValue, sizeof(event.variantValue));
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
DHookGetParamObjectPtrString(params, 3, 0, ObjectValueType_String, event.variantValue, sizeof(event.variantValue));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Action OnTrigger(const char[] output, int caller, int activator, float delay)
|
public Action OnTrigger(const char[] output, int caller, int activator, float delay)
|
||||||
{
|
{
|
||||||
if(activator <= MAXPLAYERS && activator > 0)
|
if(activator <= MAXPLAYERS && activator > 0)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user