fix: use vanilla Rust commands, add Give Item + Teleport

Switched to global.kill (vanilla), removed plugin warnings from both
buttons. Added inventory.giveto (prompts shortname + amount) and
entity.teleport (prompts target SteamID). Split actions into two rows:
player actions + admin roles. Added .btn-outline-purple CSS.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-06-13 19:05:25 +02:00
co-authored by Copilot
parent aa9bd725aa
commit 1ecb7488fe
2 changed files with 35 additions and 4 deletions
+23 -4
View File
@@ -27,9 +27,13 @@ function PlayerInfoPage(params, container) {
'<div id="pi-fields" class="row"><span class="text-white-50">Loading…</span></div>' +
'</div>' +
'<div id="pi-actions" class="col-lg-12 mt-3" style="display:none">' +
'<div class="btn-group d-flex">' +
'<div class="btn-group d-flex mb-2">' +
'<button id="pi-kill" class="btn btn-outline-danger"><i class="bi bi-skull"></i> Kill</button>' +
'<button id="pi-heal" class="btn btn-outline-success"><i class="bi bi-heart-fill"></i> Heal</button>' +
'<button id="pi-give" class="btn btn-outline-purple"><i class="bi bi-gift-fill"></i> Give Item</button>' +
'<button id="pi-teleport" class="btn btn-outline-info"><i class="bi bi-signpost-2-fill"></i> Teleport To</button>' +
'</div>' +
'<div class="btn-group d-flex">' +
'<button id="pi-mod" class="btn btn-outline-info"><i class="bi bi-shield-check"></i> Moderator</button>' +
'<button id="pi-owner" class="btn btn-outline-warning"><i class="bi bi-star-fill"></i> Owner</button>' +
'</div>' +
@@ -108,17 +112,32 @@ function PlayerInfoPage(params, container) {
var pname = document.getElementById('pi-username');
document.getElementById('pi-kill').addEventListener('click', function () {
if (confirm('Kill ' + pname.textContent + '? (plugin required)')) {
Rcon.command('kill ' + userid);
if (confirm('Kill ' + pname.textContent + '?')) {
Rcon.command('global.kill ' + userid);
}
});
document.getElementById('pi-heal').addEventListener('click', function () {
if (confirm('Heal ' + pname.textContent + '? (plugin required)')) {
if (confirm('Heal ' + pname.textContent + '?')) {
Rcon.command('heal ' + userid);
}
});
document.getElementById('pi-give').addEventListener('click', function () {
var item = prompt('Item shortname (e.g. wood, rifle.ak):', '');
if (!item) return;
var amount = prompt('Amount (default 1):', '1');
if (amount === null) return;
Rcon.command('inventory.giveto ' + userid + ' ' + item.trim() + ' ' + (parseInt(amount) || 1));
});
document.getElementById('pi-teleport').addEventListener('click', function () {
var target = prompt('Teleport ' + pname.textContent + ' to SteamID:', '');
if (target) {
Rcon.command('entity.teleport ' + userid + ' ' + target.trim());
}
});
document.getElementById('pi-mod').addEventListener('click', function () {
if (confirm('Promote ' + pname.textContent + ' to Moderator?')) {
Rcon.command('moderatorid ' + userid + ' ' + pname.textContent);
+12
View File
@@ -61,6 +61,18 @@ a:hover { color: #fff; text-decoration: none; }
color: rgba(255,255,255,0.85);
}
/* Purple outline button */
.btn-outline-purple {
--bs-btn-color: #a78bfa;
--bs-btn-border-color: #a78bfa;
--bs-btn-hover-bg: #a78bfa;
--bs-btn-hover-border-color: #a78bfa;
--bs-btn-hover-color: #fff;
--bs-btn-active-bg: #8b5cf6;
--bs-btn-active-border-color: #8b5cf6;
--bs-btn-active-color: #fff;
}
/* Table styles */
#PlayerListController .table-responsive {
min-height: calc(100vh - 200px);