View Single Post
Author Message
Aceleracion
Member
Join Date: Jul 2017
Location: Ecuador
Old 11-09-2017 , 01:42   [L4D2] HUD Server Logo
Reply With Quote #1

Note:
The included script is not an .sp file, but a .nut. That's because left 4 dead 2 does not support the HUD synchronization object created by sourcemod and the user messages through the StartMessage function. Valve launched the L4D2 EMS (Left 4 Dead 2 Expanded Mutation System) which now includes methods to make a controllable "HUD" scripted to make simple text-based UIs for your game modes.
More information in: https://developer.valvesoftware.com/.../Appendix:_HUD

Info

This VScript allows a text on the screen (HUD) to be displayed with some settings.

Images
Name:  server_text2.jpg
Views: 14278
Size:  43.3 KB

VScript File
Code:
HUDTable <-
{
	Fields = 
	{
		logo = { slot = HUD_FAR_RIGHT, dataval = "Your Text/Logo", flags = HUD_FLAG_ALIGN_CENTER | HUD_FLAG_NOBG, name = "logo" }
	}
}

HUDSetLayout(HUDTable) //Applies a HUD to the screen
//HUDPlace( HUD_FAR_RIGHT, 0.8 , 0.04 , 0.5 , 0.1) //Uncomment this line if you want to configure the text box: make it larger or change it on the screen 
g_ModeScript // Global reference to the Mode Script scope
Settings
- HUDTable: Table that defines your in-game HUD
- Fields: This contains whichever of these you want - though you _need_ a slot and at least one data element!
  • slot: which HUD_ slot on screen you want this to use - NECESSARY, w/o a slot nothing makes sense.
  • dataval: The value static (Your server logo).
  • flags: Custom flags for background, time, alignment, which team, pre or postfix, etc.
  • name: Cosmetic name for debugging, not used by code at the moment.
- HUDSetLayout(HUDTable): Applies a HUD to the screen. Do not erase this line of code.
- g_ModeScript: Global reference to the Mode Script scope. Does load the script when set/change the game mode.
- HUDPlace (slot, x, y, w, h) (Optional): If you want to configure the text box: make it larger because the text is not complete or change its position on the screen.
* Note: x,y,w,h are all 0.0-1.0 screen relative coordinates (actually, a bit smaller than the screen, but anyway).
  • x: coordinate x of the hud
  • y: coordinate y of the hud
  • w: width of the hud
  • h: height of the hud

Flags Values:
Code:
HUD_FLAG_PRESTR/POSTST: do you want a string/value pair to start(pre) or end(post) with the static string (default is PRE)
HUD_FLAG_BEEP: Makes a countdown timer blink
HUD_FLAG_BLINK: do you want this field to be blinking
HUD_FLAG_COUNTDOWN_WARN: auto blink when the timer gets under 10 seconds
HUD_FLAG_NOBG: dont draw the background box for this UI element
HUD_FLAG_ALLOWNEGTIMER: by default Timers stop on 0:00 to avoid briefly going negative over network, this keeps that from happening.
HUD_FLAG_SHOW_TIME: treat this float value as a Time (i.e. 00:00) instead of a floating value
HUD_FLAG_NOTVISIBLE: if you want to keep the slot data but keep it from displaying
HUD_FLAG_ALIGN_LEFT: Left justify this text
HUD_FLAG_ALIGN_CENTER: Center justify this text
HUD_FLAG_ALIGN_RIGHT: Right justify this text
HUD_FLAG_TEAM_SURVIVORS: only show to the survivor team
HUD_FLAG_TEAM_INFECTED: only show to the special infected team
Slot Positions:



* The name of the file has to be the name of its game mode. If your server is coop, the file should be called coop.nut, if it is versus: versus.nut, and so on for other game modes.

Installation:
  • Download the file and extract in left4dead2\scripts\vscripts
  • Rename the file by the name of its game mode. (The value of cvar mp_gamemode)
  • You can settings it to your liking.
Attached Files
File Type: zip l4d2_Hud_Server_Logo.zip (1.3 KB, 1318 views)
__________________
by Aceleración
To succeed in your goals, use your true potential

Last edited by Aceleracion; 11-28-2017 at 03:01. Reason: incorporate HUDPlace
Aceleracion is offline