Raised This Month: $ Target: $400
 0% 

SDKHooks SetTransmit error?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 02-24-2017 , 11:52   SDKHooks SetTransmit error?
Reply With Quote #1

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
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D

Last edited by Lux; 02-24-2017 at 14:05.
Lux is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:02.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode