Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

centerprint

From Quake Wiki

void centerprint(entity player, string msg)

Usage[edit]

Prints a message to a specific player in the center of their screen. Unlike other print statements, newer calls will completely override previous ones, disallowing chaining. Ending with \n is also not necessary but will still add new lines to the message when printed.

This builtin has special functionality in that it can accept an unlimited number of string arguments (with a cap of 255 characters in a string). Multiple versions of the builtin can be assigned to the same index with as many additional string arguments as needed e.g.

    void centerprint3(entity player, string start, string middle, string end) = #73;

This is incredibly useful in this case since it can allow insertion of numbers into the middle of a string which would normally be impossible.

centerprint3(player, "There are ", ftos(self.count), " switches remaining");

will display as "There are 4 switches remaining" if self.count is 4.

Parameters[edit]

  • player
The player to send the message to.
  • msg
The message to display.

Example[edit]

// On use, send out a message to every client
for (entity player = find(world, classname, "player"); player; player = find(player, classname, "player")
{
    centerprint(player, "Only 3 more buttons to go");
}