Clientcmd
From EventScripts Community Encyclopedia
|
New in EventScripts 1.5: See the Authorization FAQ for some detailed information on using clientcmd.
[edit] OverviewSyntax: Note: Command parameters are described inside the
< and > characters. Optional parameters are contained within [ and ] characters.Variation of this command that doesn't expand variables: none [edit] DescriptionRegisters a say or console command that will initiate the specified block of code when used by an authorized player, passing its parameters. [edit] Parameters
[edit] Examples// ./addons/eventscripts/myaddon/es_myaddon.txt // Say command only authorized players can execute block load { // Register a say command to the block mysaycmd with the 'use_broadcast' capability // If at this point an auth provider is not loaded the following line will error. // This works similar to es_regsaycmd only it allows capabilities/permissions clientcmd create say broadcast "myaddon/mysaycmd" "use_broadcast" #admin // Possible values for the recommend level include: #root, #admin, #poweruser, #known, #all } block mysaycmd { // The user must be authorized so let's display the text es_set myaddon_userid 0 es_set myaddon_username 0 es_set myaddon_broadcast 0 // Get the player's name es_getcmduserid myaddon_userid es_getplayername myaddon_username server_var(myaddon_userid) // Get the text to broadcast es_getargs myaddon_broadcast // Format the text to broadcast to include the player's name es_formatv myaddon_broadcast "%1: %2" myaddon_username myaddon_broadcast // Broadcast the message esnq es_xcentermsg server_var(myaddon_broadcast) } block unload { // Now we delete the say command since we are done with it // This works similar to es_unregsaycmd clientcmd delete say broadcast } // Console commands work much the same way only they use: clientcmd create console <command name> <block to call> <capability name> <permission level> clientcmd delete console <command name>
[edit] Notes
[edit] See also
|
