"Chat Games" is a plugin for the game Rust developed using Oxide/uMod. This plugin introduces a dynamic question-and-answer game within the chat, promoting interaction and competitiveness among players by asking questions across various categories and rewarding the first player who answers correctly.
json
Copiar código
{
"Categories": {
"football": [
{
"QuestionText": "In what year was the first FIFA World Cup held?",
"Answer": "1930"
},
{
"QuestionText": "Which country has won the most World Cups?",
"Answer": "brazil"
},
{
"QuestionText": "Who is the all-time top scorer in World Cup history?",
"Answer": "miroslav klose"
},
// More questions...
],
"history": [
{
"QuestionText": "In what year did World War II begin?",
"Answer": "1939"
},
{
"QuestionText": "Who was the first President of the United States?",
"Answer": "george washington"
},
{
"QuestionText": "Which ancient civilization built the pyramids?",
"Answer": "egyptian"
},
// More questions...
],
"others": [
{
"QuestionText": "What is the capital of France?",
"Answer": "paris"
},
{
"QuestionText": "What is the capital of Spain?",
"Answer": "madrid"
},
{
"QuestionText": "What is the most abundant metal on Earth?",
"Answer": "iron"
},
// More questions...
]
},
"Interval": 1200.0,
"RewardCommand": "giveto %steamid% scrap 100",
"RewardText": "The first player to answer correctly wins 100 scrap!"
}
Main Features:
- Randomized Questions:
- The plugin selects random questions from predefined categories such as Football, History, and General Knowledge.
- Timed Intervals:
- Questions are asked at regular intervals defined by the server admin.
- Minimum Player Requirement:
- Questions are only asked if a minimum number of players are active on the server.
- Reward System:
- Players who answer correctly are rewarded with items or resources using a customizable command.
- Permission Control:
- Commands and certain actions are restricted to players with specific permissions.
- Console and Chat Commands:
- Admins can manually start questions or check the time remaining for the next question.
- Levenshtein Distance Algorithm:
- To determine if an answer is correct, the plugin uses a similarity algorithm to allow for minor typos.
Commands:
- /iniciarpregunta [category]
- Description: Manually starts a question from the specified category. Defaults to "others" if no category is specified.
- Permission Required: chatgames.admin
- /tiemporestante
- Description: Displays the time remaining until the next automatic question.
- Permission Required: None
- Console Command: iniciarpregunta [category]
- Description: Console command for starting a question from the specified category.
- Permission Required: Admin status
Configuration:
The plugin uses a configuration file to store settings and questions. Below is the default configuration structure:json
Copiar código
{
"Categories": {
"football": [
{
"QuestionText": "In what year was the first FIFA World Cup held?",
"Answer": "1930"
},
{
"QuestionText": "Which country has won the most World Cups?",
"Answer": "brazil"
},
{
"QuestionText": "Who is the all-time top scorer in World Cup history?",
"Answer": "miroslav klose"
},
// More questions...
],
"history": [
{
"QuestionText": "In what year did World War II begin?",
"Answer": "1939"
},
{
"QuestionText": "Who was the first President of the United States?",
"Answer": "george washington"
},
{
"QuestionText": "Which ancient civilization built the pyramids?",
"Answer": "egyptian"
},
// More questions...
],
"others": [
{
"QuestionText": "What is the capital of France?",
"Answer": "paris"
},
{
"QuestionText": "What is the capital of Spain?",
"Answer": "madrid"
},
{
"QuestionText": "What is the most abundant metal on Earth?",
"Answer": "iron"
},
// More questions...
]
},
"Interval": 1200.0,
"RewardCommand": "giveto %steamid% scrap 100",
"RewardText": "The first player to answer correctly wins 100 scrap!"
}
Key Configuration Fields:
- Categories:
- A dictionary of question categories, each containing a list of questions and their respective answers.
- Interval:
- The time interval (in seconds) between each question. Default is 1200 seconds (20 minutes).
- RewardCommand:
- The command executed to reward the player who answers correctly. Uses %steamid% as a placeholder for the player's Steam ID.
- RewardText:
- The text displayed in the chat to announce the reward for the correct answer.