Usermsg

From EventScripts Community Encyclopedia


Module: usermsg

Module Overview

EventScripts version: 2.0

Table of Contents

Contents


Description

This library provides simple, high-level access to common usermessages.

Quick Example

Fade all Counter-Terrorist player's screens:

import usermsg
 
usermsg.fade('#ct', 1, 2, 10, 255, 255, 255)

Module Content

Classes

(none)

Methods



IMPORTANT NOTE:

The first parameter for every function in the usermsg module is users. This controls where the usermessage should be sent to. This parameter accepts the following values:
  • playerlib filters. All filters supported by playerlib's player list functions (#all, #alive, #dead, #bot, #human, #ct, etc.)
  • sequence of userids. A tuple or list of userids.
  • userid. In a string or an integer.


usermsg.fade(users, type, time, hold time, r, g, b[, a=255])
Fades users screens.

type can be:
  • 0: No fade
  • 1: Fade out
  • 2: Fade in
time is the time that it takes for the effect to take place (see above for effect).

usermsg.shake(users, magnitude, time)

Shakes users screens.

usermsg.motd(users, type, title, msg [, visibility=True])

Shows an MOTD window in users screens.

type can be:
  • 0: Text (set the msg parameter to be the contents of the window)
  • 1: URL (set the msg parameter to a URI)
  • 2: File (set the msg parameter to a locally stored file)
visiblity may be a boolean value. Setting this value to False will hide the currently open MOTD window.

usermsg.hudhint(users, msg)

Shows a hint box on users HUD.

usermsg.centermsg(users, msg)

Show a message in the center of users screens.

usermsg.echo(users, msg)

Print a message into users console.

usermsg.saytext2(users, index, msg [, arg1[, arg2[, arg3[, arg4]]]])

Shows a coloured message in a players chat window.

index is the entity index of the player whose team colour will be used for \x03 coloured parts of the message.
Example on how to retrieve a player's entity index:
import playerlib
 
player = playerlib.getPlayer(userid)
index = player.attributes['index']

msg may be a translation (like #Game_radio_location, etc [all available in cstrike/resource/cstrike_english.txt]) or your own custom message. You can use control characters like:

  • \x01: Use the default colour.
  • \x03: Use the player's team colour (see index information above).
  • \x04: Use dark green.


arg1-4 may be arguments for translations that use parameters like %s1, %s2, etc. in their values.

usermsg.showVGUIPanel(users, panelname, visibility [, data={}])

Shows / hides a VGUI panel on users screen. To hide a panel, set the visibility parameter to False.

panelname can be (but not limited to) the following:
  • all: All panels (presumably this would only work when hiding panels)
  • active: The currently highlighted panel (not confirmed)
  • scores: Scoreboard
  • overview: Radar / overview map
  • specgui: Spectator GUI (top bar when spectator)
  • specmenu: Spectator Menu (bottom bar when spectator)
  • info: MOTD window
  • nav_progress: Navigation Build Progress
  • team: Team selection screen
  • class: Generic class selection screen
  • class_ter: Terrorist class selection screen
  • class_ct: Counter-Terrorist class selection screen
usermsg.hudmsg(users, msg [, channel=0[, x=0.5[, y=0.5[, r1=255[, g1=255[, b1=255[, a1=255[, r2=255[, g2=255[, b2=255[, a2=255[, effect=0[, fadein=0.1[, fadeout=0.1[, holdtime=4.0[, fxtime=0.0]]]]]]]]]]]]]]]])
Shows a coloured message on a players HUD (not supported on CS:S).

X + Y can be any value from 0 through 1, -1 means center. They are screen resolution independent.

effect may be:
  • 0: The message fades in, then out.
  • 1: The text flickers (like credits).
  • 2: The text is printed out a character at a time (like the training room).

Fadein + Fadeout are the amount of time it takes to fade in and out (per character if using effect 2).

Holdtime is how long the message stays on screen.

|seealso=Corelib usermsg

See Also

{{{seealso}}}

blog comments powered by Disqus