mirror of
https://github.com/Resxt/Plutonium-T6-Scripts.git
synced 2025-04-20 05:55:43 +00:00
chat_command_dvars 1.0.0
This commit is contained in:
parent
bde7055118
commit
31702d9b73
@ -70,6 +70,20 @@ set cc_permission_4 ""
|
|||||||
- If you prefer to display information (error messages, status change etc.) in the player's chat rather than on his screen you can do that on a dedicated server. For this you need to install [t6-gsc-utils.dll](https://github.com/fedddddd/t6-gsc-utils#installation) (dedicated server only) and change `self IPrintLnBold(message);` to `self tell(message);` in the `TellPlayer` function
|
- If you prefer to display information (error messages, status change etc.) in the player's chat rather than on his screen you can do that on a dedicated server. For this you need to install [t6-gsc-utils.dll](https://github.com/fedddddd/t6-gsc-utils#installation) (dedicated server only) and change `self IPrintLnBold(message);` to `self tell(message);` in the `TellPlayer` function
|
||||||
- Support for clantags was added. You can use the player names in-game or in the dvars without having to care about their clantag. The [setClantag function](https://github.com/fedddddd/t6-gsc-utils#chat) replaces the player name so additional work was required to make the script ignore the clantag
|
- Support for clantags was added. You can use the player names in-game or in the dvars without having to care about their clantag. The [setClantag function](https://github.com/fedddddd/t6-gsc-utils#chat) replaces the player name so additional work was required to make the script ignore the clantag
|
||||||
|
|
||||||
|
## chat_command_dvars.gsc
|
||||||
|
|
||||||
|
3 related commands in one file:
|
||||||
|
|
||||||
|
- Print server dvar
|
||||||
|
- Change server dvar
|
||||||
|
- Change client dvar
|
||||||
|
|
||||||
|
| Name | Description | Arguments expected | Example | Permission level |
|
||||||
|
|---|---|---|---|---|
|
||||||
|
| getdvar | Prints the (server) dvar value in the player's chat | (1) the dvar name | `!getdvar g_speed` | 2 |
|
||||||
|
| setdvar | Changes a dvar on the server | (1) the dvar name (2) the new dvar value | `!setdvar jump_height 500` | 4 |
|
||||||
|
| setclientdvar | Changes a dvar on the targeted player | (1) the name of the player (2) the dvar name (3) the new dvar value | `!setclientdvar Resxt cg_thirdperson 1` | 4 |
|
||||||
|
|
||||||
## chat_command_god_mode.gsc
|
## chat_command_god_mode.gsc
|
||||||
|
|
||||||
Toggles whether the targeted player is in god mode (invincible) or not.
|
Toggles whether the targeted player is in god mode (invincible) or not.
|
||||||
|
104
chat_commands/chat_command_dvars.gsc
Normal file
104
chat_commands/chat_command_dvars.gsc
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
#include scripts\chat_commands;
|
||||||
|
|
||||||
|
Init()
|
||||||
|
{
|
||||||
|
CreateCommand(level.chat_commands["ports"], "getdvar", "function", ::GetDvarCommand, 2);
|
||||||
|
CreateCommand(level.chat_commands["ports"], "setdvar", "function", ::SetDvarCommand, 4);
|
||||||
|
CreateCommand(level.chat_commands["ports"], "setclientdvar", "function", ::SetPlayerDvarCommand, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Command section */
|
||||||
|
|
||||||
|
GetDvarCommand(args)
|
||||||
|
{
|
||||||
|
if (args.size < 1)
|
||||||
|
{
|
||||||
|
return NotEnoughArgsError(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
error = GetServerDvar(args[0]);
|
||||||
|
|
||||||
|
if (IsDefined(error))
|
||||||
|
{
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SetDvarCommand(args)
|
||||||
|
{
|
||||||
|
if (args.size < 2)
|
||||||
|
{
|
||||||
|
return NotEnoughArgsError(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
error = SetServerDvar(args[0], args[1], false);
|
||||||
|
|
||||||
|
if (IsDefined(error))
|
||||||
|
{
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SetPlayerDvarCommand(args)
|
||||||
|
{
|
||||||
|
if (args.size < 3)
|
||||||
|
{
|
||||||
|
return NotEnoughArgsError(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
error = SetPlayerDvar(args[0], args[1], args[2]);
|
||||||
|
|
||||||
|
if (IsDefined(error))
|
||||||
|
{
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Logic section */
|
||||||
|
|
||||||
|
GetServerDvar(dvarName)
|
||||||
|
{
|
||||||
|
if (DvarIsInitialized(dvarName))
|
||||||
|
{
|
||||||
|
self thread TellPlayer(array("^5" + dvarName + " ^7is currently set to ^5" + GetDvar(dvarName)), 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return DvarDoesNotExistError(dvarName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SetServerDvar(dvarName, dvarValue, canSetUndefinedDvar)
|
||||||
|
{
|
||||||
|
if (IsDefined(canSetUndefinedDvar) && canSetUndefinedDvar)
|
||||||
|
{
|
||||||
|
SetDvar(dvarName, dvarValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (DvarIsInitialized(dvarName))
|
||||||
|
{
|
||||||
|
SetDvar(dvarName, dvarValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return DvarDoesNotExistError(dvarName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SetPlayerDvar(playerName, dvarName, dvarValue)
|
||||||
|
{
|
||||||
|
player = FindPlayerByName(playerName);
|
||||||
|
|
||||||
|
if (!IsDefined(player))
|
||||||
|
{
|
||||||
|
return PlayerDoesNotExistError(playerName);
|
||||||
|
}
|
||||||
|
|
||||||
|
player SetClientDvar(dvarName, dvarValue);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user