Skip to content

Commit

Permalink
Location is now based when picture is taken
Browse files Browse the repository at this point in the history
  • Loading branch information
MonkeyWhisper committed Apr 18, 2023
1 parent eee0774 commit d36586e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
13 changes: 10 additions & 3 deletions client/cl_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -208,21 +208,27 @@ function CameraLoop()
end)
end

RegisterNetEvent("ps-camera:getStreetName", function(url, coords)
local streetHash, crossingHash = GetStreetNameAtCoord(coords.x, coords.y, coords.z)
local streetName = GetStreetNameFromHashKey(streetHash)

TriggerServerEvent("ps-camera:savePhoto", url, streetName)
end)


RegisterNetEvent("ps-camera:usePhoto", function(url, location)
photo = not photo

if photo then
SetNuiFocus(true, true)
SendNUIMessage({action = "openPhoto", image = url})
SetNuiFocus(true, true);
SendNUIMessage({action = "openPhoto", image = url, location = location})

local ped = PlayerPedId()
SharedRequestAnimDict("amb@world_human_tourist_map@male@base", function()
TaskPlayAnim(ped, "amb@world_human_tourist_map@male@base", "base", 2.0, 2.0, -1, 1, 0, false, false, false)
end)

local coords = GetEntityCoords(ped)
SetLocation(location.x, location.y, location.z)

if not HasModelLoaded("prop_cs_planning_photo") then
LoadPropDict("prop_cs_planning_photo")
Expand All @@ -234,6 +240,7 @@ RegisterNetEvent("ps-camera:usePhoto", function(url, location)
end
end)


RegisterNUICallback("close", function()
SetNuiFocus(false, false)
photo = false
Expand Down
18 changes: 11 additions & 7 deletions server/sv_main.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
local QBCore = exports['qb-core']:GetCoreObject()
local json = require("json")

-- Add Discord webhook here.
local webhook = "https://discord.com/api/webhooks/1092328311235018752/Wk77hKe1KXH7Ltg3DF5uC1jDOKg_3F-NolpClxHyqgS_qgHd5z5fCX-xn7qsX4THjKcM"
local webhook = ""

RegisterNetEvent("ps-camera:cheatDetect", function()
DropPlayer(source, "Cheater Detected")
Expand All @@ -19,11 +18,16 @@ RegisterNetEvent("ps-camera:CreatePhoto", function(url)
if not player then return end

local coords = GetEntityCoords(GetPlayerPed(source))
local location = {
x = coords.x,
y = coords.y,
z = coords.z
}

TriggerClientEvent("ps-camera:getStreetName", source, url, coords)
end)

RegisterNetEvent("ps-camera:savePhoto", function(url, streetName)
local source = source
local player = QBCore.Functions.GetPlayer(source)
if not player then return end

local location = streetName

local info = {
image = url,
Expand Down

0 comments on commit d36586e

Please sign in to comment.