Raised This Month: $51 Target: $400
 12% 

[STOCK] Usage of env_instructor_hint as a HUD


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 01-21-2016 , 19:50   [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #1

Many ppl. asked me for this so I decided to make this public.
There are already plugins on this forum which make use of this entity,
but there was no stock which supports all features,
my stock doesn't support ALL features, but all you'll need.

More details can be found here: https://developer.valvesoftware.com/...nstructor_hint

Supported Games: L4D2 and CS:GO

PHP Code:
/* Available icons
    "icon_bulb"
    "icon_caution"
    "icon_alert"
    "icon_alert_red"
    "icon_tip"
    "icon_skull"
    "icon_no"
    "icon_run"
    "icon_interact"
    "icon_button"
    "icon_door"
    "icon_arrow_plain"
    "icon_arrow_plain_white_dn"
    "icon_arrow_plain_white_up"
    "icon_arrow_up"
    "icon_arrow_right"
    "icon_fire"
    "icon_present"
    "use_binding"
*/

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_offscreen"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);

__________________

Last edited by zipcore; 01-23-2016 at 00:12.
zipcore is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 01-21-2016 , 21:46   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #2

Looks amazing http://steamcommunity.com/sharedfile.../?id=605710852

This can be extremly useful!

But I am testing it but I cant make for work with the gameinstructor disabled in my client "gameinstructor_enable 1". I need to enable it in my client, if not, dont work for me. Someone can test it with "gameinstructor_enable 0" for check if it works?

Also exist this cvar for servers "sv_gameinstructor_disable" but I think that only force to have gameinstructor disabled, no force to have it enabled.


I am waiting for feedback about this. Because no idea if is only me, but seems that it dont work well


btw, this works too in CS:GO https://forums.alliedmods.net/showth...16#post1533616 (but with "gameinstructor_enable 1")
__________________
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.


Last edited by Franc1sco; 01-21-2016 at 21:54.
Franc1sco is offline
Send a message via MSN to Franc1sco
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 01-22-2016 , 08:57   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #3

hopefully we can find a way to enable it even when user have instruction turned off
__________________
8guawong is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 01-22-2016 , 11:43   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #4

Probably a good idea to mention that it only works in L4D2 and CS:GO.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
th7nder
Senior Member
Join Date: Oct 2014
Old 01-22-2016 , 12:58   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #5

You have an error in your stock:

Code:
DispatchKeyValue(iEntity, "hint_icon_onscreen", sIconOnScreen); 
DispatchKeyValue(iEntity, "hint_icon_onscreen", sIconOffScreen);
change to:
Code:
DispatchKeyValue(iEntity, "hint_icon_onscreen", sIconOnScreen); 
DispatchKeyValue(iEntity, "hint_icon_offscreen", sIconOffScreen);
th7nder is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 01-23-2016 , 00:15   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #6

Quote:
Originally Posted by 8guawong View Post
hopefully we can find a way to enable it even when user have instruction turned off
Most ppl have the instructor enabled, cuz there is no need to disable it since it's disabled server-side by default, furthermore at least you can announce the setting to players when they have it disabled.

Quote:
Originally Posted by Powerlord View Post
Probably a good idea to mention that it only works in L4D2 and CS:GO.
...done

Quote:
Originally Posted by th7nder View Post
You have an error in your stock:

Code:
DispatchKeyValue(iEntity, "hint_icon_onscreen", sIconOnScreen); 
DispatchKeyValue(iEntity, "hint_icon_onscreen", sIconOffScreen);
change to:
Code:
DispatchKeyValue(iEntity, "hint_icon_onscreen", sIconOnScreen); 
DispatchKeyValue(iEntity, "hint_icon_offscreen", sIconOffScreen);
thanks, I've updated the first posting
__________________
zipcore is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 01-23-2016 , 11:10   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #7

Quote:
Originally Posted by zipcore View Post
Most ppl have the instructor enabled, cuz there is no need to disable it since it's disabled server-side by default, furthermore at least you can announce the setting to players when they have it disabled.



...done



thanks, I've updated the first posting
i have it disabled...
most people who play competitive have it disabled as well probably
__________________
8guawong is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 01-23-2016 , 14:47   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #8

Quote:
Originally Posted by 8guawong View Post
i have it disabled...
most people who play competitive have it disabled as well probably
+1
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.
KissLick is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 01-24-2016 , 00:14   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #9

Quote:
Originally Posted by 8guawong View Post
i have it disabled...
most people who play competitive have it disabled as well probably
Which is not needed, since it's disabled by default serverside ;) even on a MM server
__________________
zipcore is offline
th7nder
Senior Member
Join Date: Oct 2014
Old 01-24-2016 , 08:47   Re: [STOCK] Usage of env_instructor_hint as a HUD
Reply With Quote #10

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 (;
th7nder is offline
Reply



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 18:32.


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