Hi, i can hook anyother entity and use SetTransmit but not
env_instructor_hint...
i'm not sure what to do, wether it's a bug or not
i'm running SM version
SourceMod 1.9.0.6049.
i forgot to say this is for Left 4 Dead 2
Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
public OnPluginStart()
{
RegConsoleCmd("sm_test", iTest);
}
public Action:iTest(iClient, iArgs)
{
static iEntity;
iEntity = CreateEntityByName("env_instructor_hint");
SDKHook(iEntity, SDKHook_SetTransmit, block);
}
public Action:block(iEntity, iClient)
{
PrintToChatAll("iEntity = %i");
return Plugin_Continue;
}
Any help would be appreciated
Orignal code:
Code:
static DirectorHint(iClient)
{
static iEntity;
iEntity = CreateEntityByName("env_instructor_hint");
if(iEntity == -1)
return;
PrintToChatAll("iEntity = %i", iEntity);
iHintRef[iClient] = EntIndexToEntRef(iEntity);
SDKHook(iEntity, SDKHook_SetTransmit, hBlockTransmit);
static String:sValues[51];
Format(sValues, sizeof(sValues), "hint%d", iClient);
DispatchKeyValue(iClient, "targetname", sValues);
DispatchKeyValue(iEntity, "hint_target", sValues);
Format(sValues, sizeof(sValues), "%i", iHintRange);
DispatchKeyValue(iEntity, "hint_range", sValues);
DispatchKeyValue(iEntity, "hint_icon_onscreen", "icon_alert");
//Format(sValues, sizeof(sValues), "%f", fHintTime);
Format(sValues, sizeof(sValues), "%f", fHintTime);
DispatchKeyValue(iEntity, "hint_timeout", sValues);
Format(sValues, sizeof(sValues), "%N(%s) is Black&White", iClient, sCharName);
DispatchKeyValue(iEntity, "hint_caption", sValues);
DispatchKeyValue(iEntity, "hint_color", sHintColour);
DispatchSpawn(iEntity);
AcceptEntityInput(iEntity, "ShowHint");
Format(sValues, sizeof(sValues), "OnUser1 !self:Kill::%f:1", fHintTime);
SetVariantString(sValues);
AcceptEntityInput(iEntity, "AddOutput");
AcceptEntityInput(iEntity, "FireUser1");
}
static bool:IsValidEntRef(iEntRef)
{
static iEntity;
iEntity = EntRefToEntIndex(iEntRef);
return (iEntRef && iEntity != INVALID_ENT_REFERENCE && IsValidEntity(iEntity));
}
public Action:hBlockTransmit(iEntity, iClient)
{
PrintToChatAll("%N entity %i", iClient, iEntity);
if(IsValidEntRef(iHintRef[iClient]))
{
PrintToChatAll("blocking from %N entity %i", iClient, iEntity);
return Plugin_Handled;
}
if(iTeamNoticeType == 2)
return Plugin_Continue;
if(iTeamNoticeType == 0)
if(GetClientTeam(iClient) != 2)
return Plugin_Handled;
if(iTeamNoticeType == 1)
if(GetClientTeam(iClient) != 3)
return Plugin_Handled;
return Plugin_Continue;
}
that is my orignal code
__________________