AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [SNIPPET][CSS] using new entity env_hudhint (https://forums.alliedmods.net/showthread.php?t=133287)

blodia 07-23-2010 18:12

[SNIPPET][CSS] using new entity env_hudhint
 
i wasn't sure where to post this so sorry if this is the wrong section, css can now use env_hudhint which means css can also use the "KeyHintText" usermessage e.g

PHP Code:

new String:Message[10] = "hello";
new 
Handle:hBuffer StartMessageOne("KeyHintText"client);
BfWriteByte(hBuffer1);
BfWriteString(hBufferMessage);
EndMessage(); 

this shows a message on the bottom right of the screen, use StartMessageAll("KeyHintText") if you want to send a message to everyone.

if you want to use the entity way.

PHP Code:

new HHIndex CreateEntityByName("env_hudhint");
if (
HHIndex != -1)
 {
    
DispatchKeyValue(HHIndex"message""hello");
    
DispatchKeyValue(HHIndex"spawnflags""1");
    
    
DispatchSpawn(HHIndex);
    
ActivateEntity(HHIndex);
    
    
AcceptEntityInput(HHIndex"ShowHudHint");
 } 

i think this way will show to all clients.

psychonic 07-23-2010 19:38

Re: new css entity env_hudhint
 
Nice example. Moved to snippets

Chrisber 07-23-2010 20:47

Re: [SNIPPET][CSS] using new entity env_hudhint
 
1 Attachment(s)
More information:
The hint holds for exactly 6 seconds and fades out then.

Screenshot see below.

Greyscale 07-23-2010 22:12

Re: [SNIPPET][CSS] using new entity env_hudhint
 
Is that even visible to the naked eye?

KyleS 07-23-2010 22:15

Re: [SNIPPET][CSS] using new entity env_hudhint
 
Thanks blodia :D

KyleS 07-27-2010 00:19

Re: [SNIPPET][CSS] using new entity env_hudhint
 
Sorry for the double post, however I can't really get this going.

Code:

public OnMapStart()
{
        ServerTimeStart();
}

public ServerTimeStart()
{
        new HHIndex = CreateEntityByName("env_hudhint");
        if (HHIndex != -1)
        {
                CreateTimer(1.0, PrintTimeEnt, HHIndex, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
        }
}

public Action:PrintTimeEnt(Handle:timer, any:HHIndex)
{
        decl String:Time[16];
        FormatTime(Time, sizeof(Time), "%H%M", (GetTime()));
        DispatchKeyValue(HHIndex, "message", Time);
        DispatchKeyValue(HHIndex, "spawnflags", "1");
       
        DispatchSpawn(HHIndex);
        ActivateEntity(HHIndex);
        AcceptEntityInput(HHIndex, "ShowHudHint");
}

AMPasteLink (incase the above has formatting issues): http://ampaste.net/f6e533a47

Chrisber 07-27-2010 07:12

Re: [SNIPPET][CSS] using new entity env_hudhint
 
Why don't you use the usermessage version? It is less hacky.

Chris

KyleS 07-27-2010 10:38

Re: [SNIPPET][CSS] using new entity env_hudhint
 
Quote:

Originally Posted by Chrisber (Post 1252934)
Why don't you use the usermessage version? It is less hacky.

Chris

True, I'll try that when I get home :wink:

EDIT:
Yeah I'm a goof, got it. You can't pass the handle through a timer, at least I don't think...

EDIT2:
Don't even try to use new lines (\n), Server will segfault.

exvel 08-10-2010 07:30

Re: [SNIPPET][CSS] using new entity env_hudhint
 
Quote:

Originally Posted by Kyle12 (Post 1253096)
Don't even try to use new lines (\n), Server will segfault.

Why? Works fine for me.

http://clip2net.com/clip/m30987/1281...-clip-99kb.jpg

GoD-Tony 08-10-2010 08:34

Re: [SNIPPET][CSS] using new entity env_hudhint
 
Quote:

Originally Posted by exvel (Post 1267137)
Why? Works fine for me.

Can you post the code you used? Thanks.

exvel 08-10-2010 11:35

Re: [SNIPPET][CSS] using new entity env_hudhint
 
Sure..
PHP Code:

decl String:szText[250];
Format(szTextsizeof(szText), "LINE #1\nLINE #2\nLINE #3\nLINE #4\nLINE #5\nLINE #6\nLINE #7\nLINE #8\nLINE #9\n");
    
new 
Handle:hBuffer StartMessageOne("KeyHintText"client);
BfWriteByte(hBuffer1);
BfWriteString(hBufferszText);
EndMessage(); 


KyleS 08-11-2010 05:17

Re: [SNIPPET][CSS] using new entity env_hudhint
 
Quote:

Originally Posted by exvel (Post 1267137)

:oops:

No idea what happened with mine then, server Segfaulted with sys_error at the top of the stack (during 6 startups, and a map change) >.<

berni 08-11-2010 12:20

Re: [SNIPPET][CSS] using new entity env_hudhint
 
You can also specify with the first byte in the usermessage, how many lines you are going to send, and then do BfWriteString for each of the lines you want to send, that's how it is meant by Valve.

KawMAN 08-11-2010 16:58

Re: [SNIPPET][CSS] using new entity env_hudhint
 
Maybe HPE fixed that crash & didn't say about it.
Beta verison changelog:
Code:

Fixed bug with env_hudhint that caused problems when its value was greater than 255 characters.

GoD-Tony 08-15-2010 08:53

Re: [SNIPPET][CSS] using new entity env_hudhint
 
Made a little plugin out of this new feature. I figured it's another example to post here if someone wants to know how it can be used.

KyleS 09-17-2010 03:37

Re: [SNIPPET][CSS] using new entity env_hudhint
 
1 Attachment(s)
Another *Example* of this: https://forums.alliedmods.net/showthread.php?t=138503

Master53 09-19-2010 17:03

Re: [SNIPPET][CSS] using new entity env_hudhint
 
is the position static or can it be changed??

KyleS 09-19-2010 23:17

Re: [SNIPPET][CSS] using new entity env_hudhint
 
Appears to be static, I'd love to move it around.

Chokitu 10-30-2014 18:37

Re: [SNIPPET][CSS] using new entity env_hudhint
 
How Can I start a sp with that I didn't get, I want to show
Welcome to the server in the messages can anyone help me?


All times are GMT -4. The time now is 18:47.

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