Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions client/world.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,45 @@ RegisterNetEvent('ps-adminmenu:client:ChangeWeather', function(data, selectedDat

TriggerServerEvent('qb-weathersync:server:setWeather', weather)
end)

RegisterNetEvent('ps-adminmenu:client:copyToClipboard', function(data, selectedData)
local data = CheckDataFromKey(data)
if not data or not CheckPerms(data.perms) then return end

local dropdown = selectedData["Copy Coords"].value
local ped = PlayerPedId()
local string = nil
if dropdown == 'vector2' then
local coords = GetEntityCoords(ped)
local x = QBCore.Shared.Round(coords.x, 2)
local y = QBCore.Shared.Round(coords.y, 2)
string = "vector2(".. x ..", ".. y ..")"
QBCore.Functions.Notify(locale("copy_vector2"), 'success')
elseif dropdown == 'vector3' then
local coords = GetEntityCoords(ped)
local x = QBCore.Shared.Round(coords.x, 2)
local y = QBCore.Shared.Round(coords.y, 2)
local z = QBCore.Shared.Round(coords.z, 2)
string = "vector3(".. x ..", ".. y ..", ".. z ..")"
QBCore.Functions.Notify(locale("copy_vector3"), 'success')
elseif dropdown == 'vector4' then
local coords = GetEntityCoords(ped)
local x = QBCore.Shared.Round(coords.x, 2)
local y = QBCore.Shared.Round(coords.y, 2)
local z = QBCore.Shared.Round(coords.z, 2)
local heading = GetEntityHeading(ped)
local h = QBCore.Shared.Round(heading, 2)
string = "vector4(".. x ..", ".. y ..", ".. z ..", ".. h ..")"
QBCore.Functions.Notify(locale("copy_vector4"), 'success')
elseif dropdown == 'heading' then
local heading = GetEntityHeading(ped)
local h = QBCore.Shared.Round(heading, 2)
string = h
QBCore.Functions.Notify(locale("copy_heading"), 'success')
elseif string == nil then
QBCore.Functions.Notify(locale("empty_input"), 'error')
end

lib.setClipboard(string)

end)
17 changes: 12 additions & 5 deletions shared/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,17 @@ Config.Actions = {
label = "Copy Coords",
perms = "mod",
dropdown = {
{ label = "Copy Vector2", option = "button", type = "command", event = "vector2" },
{ label = "Copy Vector3", option = "button", type = "command", event = "vector3" },
{ label = "Copy Vector4", option = "button", type = "command", event = "vector4" },
{ label = "Copy Heading", option = "button", type = "command", event = "heading" },
{
label = "Copy Coords",
option = "dropdown",
data = {
{ label = "Copy Vector2", value = "vector2" },
{ label = "Copy Vector3", value = "vector3" },
{ label = "Copy Vector4", value = "vector4" },
{ label = "Copy Heading", value = "heading" },
},
},
{ label = "Copy to Clipboard", option = "button", type = "client", event = "ps-adminmenu:client:copyToClipboard"},
},
},

Expand Down Expand Up @@ -511,7 +518,7 @@ Config.Actions = {
},
},

["spactate_player"] = {
["spectate_player"] = {
label = "Spectate Player",
perms = "mod",
dropdown = {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/Actions/components/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<button
class="min-h-[4.5vh] w-full flex items-center px-[1.5vh] rounded-[0.5vh] bg-tertiary hover:bg-opacity-90"
on:click={() => {
console.log(data.event)
// console.log(data.event)
SendNUI('clickButton', {
data: id,
})
Expand Down
10 changes: 5 additions & 5 deletions ui/src/pages/Actions/components/Dropdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
let selectedDataArray = {}

function SelectData(selectedData) {
console.log('selected', selectedData)
// console.log('selected', selectedData)
selectedDataArray[selectedData.id] = selectedData
}

Expand All @@ -23,14 +23,14 @@
data.event = event
data.type = type
}
console.log('data', data)
console.log('event', data.event)
console.log('type', data.type)
// console.log('data', data)
// console.log('event', data.event)
// console.log('type', data.type)
SendNUI('clickButton', {
data: id,
selectedData: selectedDataArray,
})
console.log(selectedDataArray)
// console.log(selectedDataArray)
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/Chat/components/SendInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
SendNUI("SendMessage", {
message: message,
});
console.log("Message sent", message)
// console.log("Message sent", message)
message = "";
setTimeout(() => {
scrollToBottom();
Expand Down
19 changes: 7 additions & 12 deletions ui/src/pages/players/Players.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
let selectedDataArray = {}

function SelectData(selectedData) {
console.log('selected', selectedData)
// console.log('selected', selectedData)
selectedDataArray[selectedData.id] = selectedData
console.log('selectedDataArray', selectedDataArray)
// console.log('selectedDataArray', selectedDataArray)
}

let banData = [
Expand Down Expand Up @@ -262,12 +262,7 @@
data-tip="Revive Player"
on:click={() =>
SendNUI('clickButton', {
data: {
label: 'Revive Player',
event: `ps-adminmenu:server:Revive`,
type: 'server',
perms: 'mod',
},
data: 'revivePlayer',
selectedData: {
['Player']: {
value: $SELECTED_PLAYER.id,
Expand Down Expand Up @@ -307,7 +302,7 @@
data-tip="Spectate Player"
on:click={() =>
SendNUI('clickButton', {
data: 'revivePlayer',
data: 'spectate_player',
selectedData: {
['Player']: {
value: $SELECTED_PLAYER.id,
Expand Down Expand Up @@ -427,8 +422,8 @@
<button
class="h-[3.8vh] px-[1.5vh] rounded-[0.5vh] bg-secondary hover:bg-opacity-90 border-[0.1vh] border-primary"
on:click={() => {
console.log('Time: ', selectedDataArray['Duration'].value)
console.log('reason: ', selectedDataArray['Reason'].value)
// console.log('Time: ', selectedDataArray['Duration'].value)
// console.log('reason: ', selectedDataArray['Reason'].value)
SendNUI('clickButton', {
data: 'banPlayer',
selectedData: {
Expand All @@ -439,7 +434,7 @@
value: selectedDataArray['Duration'].value,
},
['Reason']: {
value: $SELECTED_PLAYER.id,
value: selectedDataArray['Reason'].value,
},
},
})
Expand Down
2 changes: 1 addition & 1 deletion ui/src/providers/BackdropFix.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
};

const createGameView = (canvas: HTMLCanvasElement) => {
console.log(canvas);
// console.log(canvas);
const gl = canvas.getContext("webgl", {
antialias: false,
depth: false,
Expand Down
2 changes: 1 addition & 1 deletion ui/src/providers/VisibilityProvider.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

ReceiveNUI('setBrowserMode', (data: boolean) => {
BROWSER_MODE.set(data)
console.log('browser mode enabled')
// console.log('browser mode enabled')
})

onMount(() => {
Expand Down