Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!
Difference between revisions of "stuffcmd"
From Quake Wiki
(Created page with "====Syntax:==== <code>void stuffcmd(entity client, string s)</code> Sends text to the console as if it had been typed by the '''client''' entity. For use with player entitie...") |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | + | ''void'' '''stuffcmd'''(''entity'' player, ''string'' cmd) | |
− | |||
− | + | == Usage == | |
− | + | Sends a message to the passed player's console. Useful for executing console commands such as the item flash on pick up. Messages should have the '''\n''' character at the end to ensure commands run properly and future messages will move to the next line. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | === Parameters === | ||
+ | *''player'' | ||
+ | :The player to send the message to. | ||
+ | *''cmd'' | ||
+ | :The message to run in the player's console e.g. a command. | ||
+ | |||
+ | == Example == | ||
+ | // Execute the item flash when a player picks up an item | ||
+ | if (other.flags & FL_CLIENT) | ||
+ | stuffcmd(other, "bf\n"); | ||
[[Category:QuakeC Function]] | [[Category:QuakeC Function]] |
Latest revision as of 15:34, 31 July 2023
void stuffcmd(entity player, string cmd)
Usage[edit]
Sends a message to the passed player's console. Useful for executing console commands such as the item flash on pick up. Messages should have the \n character at the end to ensure commands run properly and future messages will move to the next line.
Parameters[edit]
- player
- The player to send the message to.
- cmd
- The message to run in the player's console e.g. a command.
Example[edit]
// Execute the item flash when a player picks up an item if (other.flags & FL_CLIENT) stuffcmd(other, "bf\n");