mirror of
https://github.com/Resxt/Plutonium-T6-Scripts.git
synced 2025-04-21 06:25:42 +00:00
chat_command_unlimited_ammo 1.0.0
This commit is contained in:
parent
4103a82fb2
commit
140b815000
@ -68,3 +68,20 @@ set cc_permission_4 ""
|
|||||||
- If you use [IW4MAdmin](https://github.com/RaidMax/IW4M-Admin) make sure you have a different commands prefix to avoid conflicts. For example `!` for IW4MAdmin commands and `.` for this script. The commands prefix can be modified by changing the value of the `cc_prefix` dvar. As for [IW4MAdmin](https://github.com/RaidMax/IW4M-Admin), at the time of writing, if you want to change it you'll need to change the value of [CommandPrefix](https://github.com/RaidMax/IW4M-Admin/wiki/Configuration#advanced-configuration)
|
- If you use [IW4MAdmin](https://github.com/RaidMax/IW4M-Admin) make sure you have a different commands prefix to avoid conflicts. For example `!` for IW4MAdmin commands and `.` for this script. The commands prefix can be modified by changing the value of the `cc_prefix` dvar. As for [IW4MAdmin](https://github.com/RaidMax/IW4M-Admin), at the time of writing, if you want to change it you'll need to change the value of [CommandPrefix](https://github.com/RaidMax/IW4M-Admin/wiki/Configuration#advanced-configuration)
|
||||||
- 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_unlimited_ammo.gsc
|
||||||
|
|
||||||
|
Toggles unlimited ammo on the targeted player.
|
||||||
|
|
||||||
|
| # | Argument | Mandatory |
|
||||||
|
|---|---|---|
|
||||||
|
| 1 | The name of the player to toggle unlimited ammo for | :white_check_mark: |
|
||||||
|
|
||||||
|
| Examples |
|
||||||
|
|---|
|
||||||
|
| `!unlimitedammo me` |
|
||||||
|
| `!unlimitedammo Resxt` |
|
||||||
|
|
||||||
|
| Permission level |
|
||||||
|
|---|
|
||||||
|
| 3 |
|
||||||
|
96
chat_commands/chat_command_unlimited_ammo .gsc
Normal file
96
chat_commands/chat_command_unlimited_ammo .gsc
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
#include scripts\chat_commands;
|
||||||
|
|
||||||
|
Init()
|
||||||
|
{
|
||||||
|
CreateCommand(level.chat_commands["ports"], "unlimitedammo", "function", ::UnlimitedAmmoCommand, 3, array("default_help_one_player"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Command section */
|
||||||
|
|
||||||
|
UnlimitedAmmoCommand(args)
|
||||||
|
{
|
||||||
|
if (args.size < 1)
|
||||||
|
{
|
||||||
|
return NotEnoughArgsError(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
error = ToggleUnlimitedAmmo(args[0]);
|
||||||
|
|
||||||
|
if (IsDefined(error))
|
||||||
|
{
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Logic section */
|
||||||
|
|
||||||
|
ToggleUnlimitedAmmo(playerName)
|
||||||
|
{
|
||||||
|
player = FindPlayerByName(playerName);
|
||||||
|
|
||||||
|
if (!IsDefined(player))
|
||||||
|
{
|
||||||
|
return PlayerDoesNotExistError(playerName);
|
||||||
|
}
|
||||||
|
|
||||||
|
commandName = "unlimitedammo";
|
||||||
|
|
||||||
|
ToggleStatus(commandName, "Unlimited Ammo", player);
|
||||||
|
|
||||||
|
if (GetStatus(commandName, player))
|
||||||
|
{
|
||||||
|
player thread DoUnlimitedAmmo();
|
||||||
|
player thread ThreadUnlimitedAmmo();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player notify("chat_commands_unlimited_ammo_off");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ThreadUnlimitedAmmo()
|
||||||
|
{
|
||||||
|
self endon("disconnect");
|
||||||
|
self endon("chat_commands_unlimited_ammo_off");
|
||||||
|
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
self waittill("spawned_player");
|
||||||
|
|
||||||
|
self thread DoUnlimitedAmmo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DoUnlimitedAmmo()
|
||||||
|
{
|
||||||
|
self endon("chat_commands_unlimited_ammo_off");
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
currentWeapon = self getCurrentWeapon();
|
||||||
|
currentoffhand = self GetCurrentOffhand();
|
||||||
|
|
||||||
|
if (currentWeapon != "none")
|
||||||
|
{
|
||||||
|
self SetWeaponAmmoClip(currentWeapon, 9999);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsSubStr(currentWeapon, "akimbo"))
|
||||||
|
{
|
||||||
|
self SetWeaponAmmoClip(currentWeapon, 9999, "left");
|
||||||
|
self SetWeaponAmmoClip(currentWeapon, 9999, "right");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( currentoffhand != "none" )
|
||||||
|
{
|
||||||
|
self setWeaponAmmoClip( currentoffhand, 9999 );
|
||||||
|
self GiveMaxAmmo( currentoffhand );
|
||||||
|
}
|
||||||
|
|
||||||
|
wait 0.05;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user