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:
+23
-4
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user