Closed matsn0w closed 3 years ago
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
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
@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
@all-contributors please add @matsn0w for bug
@TGRHavoc
I've put up a pull request to add @matsn0w! :tada:
Lol, thanks bro :)
Oh, now you've fixed it the wrong way around XD I'll submit a PR.
see #70
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:
Expected behavior License plate should be removed from player info.
Screenshots![image](https://user-images.githubusercontent.com/15019582/130782095-a316acae-9f05-4081-b28f-09d236b641d1.png)
Desktop (please complete the following information):
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()
:and