Raised This Month: $32 Target: $400
 8% 

[STOCK] Usage of env_instructor_hint as a HUD


Post New Thread Reply   
 
Thread Tools Display Modes
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 01-25-2016 , 20:57   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #11

Quote:
Originally Posted by th7nder View Post
I think that best solution is what zipcore told before, query client convar if he has it disabled, change display type to PrintHintText, or tell him by chat to enable hints (;
correct
__________________
zipcore is offline
Darkness_
Veteran Member
Join Date: Nov 2014
Old 01-31-2016 , 16:50   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #12

Thanks for sharing, this is really neat.
Darkness_ is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 02-02-2016 , 12:16   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #13

Some people ask me for the exactly code that I used here so the code that I used is:
PHP Code:
#include <sourcemod>
#include <sdktools>

public OnPluginStart()
{
    
RegConsoleCmd("sm_testing"probar);
}

public 
Action probar (clientargs)
{
    
DisplayInstructorHint(client5.00.10.1truefalse"icon_run""icon_run"""true, {2552550}, "TESTING NEW HUD FOR ADD TO SOURCEMOD PLUGINS");

    
PrintToChat(client"hecho"); // show chat debug
    
    
return Plugin_Handled;
}

stock void DisplayInstructorHint(int iTargetEntityfloat fTimefloat fHeightfloat fRangebool bFollowbool bShowOffScreenchar[] sIconOnScreenchar[] sIconOffScreenchar[] sCmdbool bShowTextAlwaysint iColor[3], char sText[100]) 

    
int iEntity CreateEntityByName("env_instructor_hint"); 
     
    if(
iEntity <= 0
        return; 
         
    
char sBuffer[32]; 
    
FormatEx(sBuffersizeof(sBuffer), "%d"iTargetEntity); 
     
    
// Target 
    
DispatchKeyValue(iTargetEntity"targetname"sBuffer); 
    
DispatchKeyValue(iEntity"hint_target"sBuffer); 
     
    
// Static 
    
FormatEx(sBuffersizeof(sBuffer), "%d", !bFollow); 
    
DispatchKeyValue(iEntity"hint_static"sBuffer); 
     
    
// Timeout 
    
FormatEx(sBuffersizeof(sBuffer), "%d"RoundToFloor(fTime)); 
    
DispatchKeyValue(iEntity"hint_timeout"sBuffer); 
    if(
fTime 0.0
        
RemoveEntity(iEntityfTime); 
     
    
// Height 
    
FormatEx(sBuffersizeof(sBuffer), "%d"RoundToFloor(fHeight)); 
    
DispatchKeyValue(iEntity"hint_icon_offset"sBuffer); 
     
    
// Range 
    
FormatEx(sBuffersizeof(sBuffer), "%d"RoundToFloor(fRange)); 
    
DispatchKeyValue(iEntity"hint_range"sBuffer); 
     
    
// Show off screen 
    
FormatEx(sBuffersizeof(sBuffer), "%d", !bShowOffScreen); 
    
DispatchKeyValue(iEntity"hint_nooffscreen"sBuffer); 
     
    
// Icons 
    
DispatchKeyValue(iEntity"hint_icon_onscreen"sIconOnScreen); 
    
DispatchKeyValue(iEntity"hint_icon_onscreen"sIconOffScreen); 
     
    
// Command binding 
    
DispatchKeyValue(iEntity"hint_binding"sCmd); 
     
    
// Show text behind walls 
    
FormatEx(sBuffersizeof(sBuffer), "%d"bShowTextAlways); 
    
DispatchKeyValue(iEntity"hint_forcecaption"sBuffer); 
     
    
// Text color 
    
FormatEx(sBuffersizeof(sBuffer), "%d %d %d"iColor[0], iColor[1], iColor[2]); 
    
DispatchKeyValue(iEntity"hint_color"sBuffer); 
     
    
//Text 
    
ReplaceString(sTextsizeof(sText), "\n"" "); 
    
DispatchKeyValue(iEntity"hint_caption"sText); 
     
    
DispatchSpawn(iEntity); 
    
AcceptEntityInput(iEntity"ShowHint"); 


stock void RemoveEntity(entityfloat time 0.0

    if (
time == 0.0
    { 
        if (
IsValidEntity(entity)) 
        { 
            
char edictname[32]; 
            
GetEdictClassname(entityedictname32); 

            if (!
StrEqual(edictname"player")) 
                
AcceptEntityInput(entity"kill"); 
        } 
    } 
    else if(
time 0.0
        
CreateTimer(timeRemoveEntityTimerEntIndexToEntRef(entity), TIMER_FLAG_NO_MAPCHANGE); 


public 
Action RemoveEntityTimer(Handle Timerany entityRef

    
int entity EntRefToEntIndex(entityRef); 
    if (
entity != INVALID_ENT_REFERENCE
        
RemoveEntity(entity); // RemoveEntity(...) is capable of handling references 
     
    
return (Plugin_Stop); 

__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.

Franc1sco is offline
Send a message via MSN to Franc1sco
cTmoNe
AlliedModders Donor
Join Date: Jul 2010
Location: Germany
Old 02-02-2016 , 21:10   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #14

Why some icons dont work?
__________________


cTmoNe is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 02-03-2016 , 08:24   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #15

Quote:
Originally Posted by ZombiMod.Com View Post
Why some icons dont work?
I took them from the valve wiki and didn't test all icons in cs:go maybe some of them are for l4d2 only for example
__________________
zipcore is offline
Addicted.
AlliedModders Donor
Join Date: Dec 2013
Location: 0xA9D0DC
Old 02-03-2016 , 11:36   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #16

Quote:
Originally Posted by zipcore View Post
I took them from the valve wiki and didn't test all icons in cs:go maybe some of them are for l4d2 only for example
Yeah I tested a few that didn't work
Addicted. is offline
Lord_Rofl
Senior Member
Join Date: Aug 2006
Location: Bad Pyrmont, Germany
Old 02-03-2016 , 14:28   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #17

I hope there is a way to display this hud to more then one player someday...
Lord_Rofl is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 02-03-2016 , 15:15   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #18

Quote:
Originally Posted by Lord_Rofl View Post
I hope there is a way to display this hud to more then one player someday...
For loops...?
__________________
ddhoward is offline
Lord_Rofl
Senior Member
Join Date: Aug 2006
Location: Bad Pyrmont, Germany
Old 02-03-2016 , 18:36   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #19

Quote:
Originally Posted by ddhoward View Post
For loops...?

dont work, only the first get the message
Lord_Rofl is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 02-03-2016 , 20:06   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #20

Why create the entity?
Can't you just send the message directly?
I do that with tf game text.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Reply


Thread Tools
Display Modes

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 05:52.


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