Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

License Plate doesn't get removed from data #68

Closed
matsn0w opened this issue Aug 25, 2021 · 7 comments
Closed

License Plate doesn't get removed from data #68

matsn0w opened this issue Aug 25, 2021 · 7 comments
Labels

Comments

@matsn0w
Copy link
Contributor

matsn0w commented Aug 25, 2021

Describe the bug
When entering a vehicle, the license plate gets added to the player data. (here). This works fine, except that it won't get removed after leaving the vehicle.

To Reproduce
Steps to reproduce the behavior:

  1. Enter a vehicle
  2. Watch player data in the interface
  3. Leave vehicle
  4. Watch player data again, license plate should still be visible

Expected behavior
License plate should be removed from player info.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10 Pro 64-bit
  • Browser: Microsoft Edge
  • Version: 92.0.902.78

Possible Solution
Not sure what's going on, I tried adding some different kind of info (emergency status, see example below) and this works as expected.

Additional context/Screenshots
In doVehicleUpdate():

-- check if the siren is turned on
local siren_on = IsVehicleSirenOn(vehicle)

-- add the emergency status to the data table
data["Emergency"] = siren_on and "Yes" or "No"

-- update the player data
TriggerServerEvent("livemap:UpdatePlayerData", "Emergency", data["Emergency"])

and

Citizen.CreateThread(function()
    while true do
        Wait(10)

        if NetworkIsPlayerActive(PlayerId()) then

            -- Update Vehicle (and icon)
            if IsPedInAnyVehicle(PlayerPedId()) then
                doVehicleUpdate()

            elseif data["Licence Plate"] ~= nil or data["Vehicle"] ~= nil then
                -- No longer in a vehicle, remove "Licence Plate" if present
                data["Licence Plate"] = nil
                data["Vehicle"] = nil
                data["Emergency"] = nil
                temp["vehicle"] = nil

                -- Remove it from socket communication
                TriggerServerEvent("livemap:RemovePlayerData", "Licence Plate")
                TriggerServerEvent("livemap:RemovePlayerData", "Emergency")
                TriggerServerEvent("livemap:RemovePlayerData", "Vehicle")
            end
        end
    end
end)
@matsn0w matsn0w added the bug label Aug 25, 2021
@TGRHavoc
Copy link
Owner

Describe the bug
When entering a vehicle, the license plate gets added to the player data. (here). This works fine, except that it won't get removed after leaving the vehicle.

To Reproduce
Steps to reproduce the behavior:

1. Enter a vehicle

2. Watch player data in the interface

3. Leave vehicle

4. Watch player data again, license plate should still be visible

Expected behavior
License plate should be removed from player info.

Screenshots
image

Desktop (please complete the following information):

* OS: Windows 10 Pro 64-bit

* Browser: Microsoft Edge

* Version: 92.0.902.78

Possible Solution
Not sure what's going on, I tried adding some different kind of info (emergency status, see example below) and this works as expected.

Additional context/Screenshots
In doVehicleUpdate():

-- check if the siren is turned on
local siren_on = IsVehicleSirenOn(vehicle)

-- add the emergency status to the data table
data["Emergency"] = siren_on and "Yes" or "No"

-- update the player data
TriggerServerEvent("livemap:UpdatePlayerData", "Emergency", data["Emergency"])

and

Citizen.CreateThread(function()
    while true do
        Wait(10)

        if NetworkIsPlayerActive(PlayerId()) then

            -- Update Vehicle (and icon)
            if IsPedInAnyVehicle(PlayerPedId()) then
                doVehicleUpdate()

            elseif data["Licence Plate"] ~= nil or data["Vehicle"] ~= nil then
                -- No longer in a vehicle, remove "Licence Plate" if present
                data["Licence Plate"] = nil
                data["Vehicle"] = nil
                data["Emergency"] = nil
                temp["vehicle"] = nil

                -- Remove it from socket communication
                TriggerServerEvent("livemap:RemovePlayerData", "Licence Plate")
                TriggerServerEvent("livemap:RemovePlayerData", "Emergency")
                TriggerServerEvent("livemap:RemovePlayerData", "Vehicle")
            end
        end
    end
end)

Yup. Because I can't keep my spelling of "Licence Plate" consistent...

@all-contributors add @matsn0w for bug

@allcontributors
Copy link
Contributor

@TGRHavoc

I could not determine your intention.

Basic usage: @all-contributors please add @Someone for code, doc and infra

For other usages see the documentation

@TGRHavoc
Copy link
Owner

@all-contributors please add @matsn0w for bug

@allcontributors
Copy link
Contributor

@TGRHavoc

I've put up a pull request to add @matsn0w! 🎉

@matsn0w
Copy link
Contributor Author

matsn0w commented Aug 25, 2021

Lol, thanks bro :)

@matsn0w
Copy link
Contributor Author

matsn0w commented Aug 25, 2021

Oh, now you've fixed it the wrong way around XD I'll submit a PR.

@matsn0w
Copy link
Contributor Author

matsn0w commented Aug 25, 2021

see #70

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants