Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generic call function which uses the command interface #77

Open
Phil25 opened this issue Dec 6, 2023 · 0 comments
Open

Add generic call function which uses the command interface #77

Phil25 opened this issue Dec 6, 2023 · 0 comments
Labels
request :: api Requesting API functionality
Milestone

Comments

@Phil25
Copy link
Owner

Phil25 commented Dec 6, 2023

Perk config is very versatile, but it can be even more so.

Example

There could be an unused-by-default call function which is able to execture commands provided via perk's settings, for example:

"myslapperk"
{
	"name"			"My Slap Perk"
	"good"			"0"
	(...)
	"settings"
	{
		"command"	"sm_slap"
		"arg1"		"%target%" // %target% gets replaced with user ID player who rolled the perk
		"arg2"		"100" // slap damage
	}
	"call"			"CustomCommand_Call"
	"init"			"CustomCommand_Init"
}

Overview

The command can be provided via the command setting and its arguments through consecutive argN settings. The function called CustomCommand_Call will parse and build a command that is run on the server, targeting the player who rolled this particular perk.

%target% will be replaced with the user ID of a player by RTD, to make sure addressing is unique and not name-dependent. Furthermore, %target% can be specified in any argument, since it's up to the command to define which argument is the target.

CustomCommand_Init will verify whether the command is valid and is safe (see section below) to run while the config is parsed. This is helpful for debugging because you can see a message in the server logs whether you configured something incorrectly.

Security

Running server commands in an unsolicited way is bad. CustomCommand_Call will always check flags of the provided command. Commands will the following flags should error out without being executed:

  1. kick
  2. ban
  3. unban
  4. changemap
  5. cvar
  6. config
  7. password
  8. rcon
  9. root
@Phil25 Phil25 added this to the 3.0.0 milestone Dec 6, 2023
@Phil25 Phil25 added the request :: api Requesting API functionality label Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request :: api Requesting API functionality
Projects
None yet
Development

No branches or pull requests

1 participant