Skip to content

Commit

Permalink
Final dev branch commits for release (#2)
Browse files Browse the repository at this point in the history
* Feat: ESX Compatibility  (#1)

* Update sv_main.lua

* Update cl_main.lua

* Update cl_main.lua

* Update cl_config.lua

* Update sv_config.lua

* Update sv_main.lua

* Update sv_main.lua

* Feat: Additional notification config + refactor esx.

* Feat: Version checker

* RFR: Removed event handler.

* Update fxmanifest.lua

* Fix: Use correct export for ghmattisql

* Fix: Removed dependency.

* RFR: Fixed event names and added esx items.

* RFR: Changed events again and added readme.

* Update README.md

* Fix: Drop player

* RFR: Check if in vehicle, check if entity exist, and additional checks

* Update readme. Final commit.

* Update README.md

Co-authored-by: Ruqen <73693641+Ruqen@users.noreply.github.com>
  • Loading branch information
RockySouthpaw and Ruqen authored May 18, 2021
1 parent faa27fd commit ace9e3e
Show file tree
Hide file tree
Showing 10 changed files with 412 additions and 151 deletions.
57 changes: 55 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,55 @@
# new-fakeplate-who-dis
**WIP DO NOT USE**
# Project Error Discord

- Join the [**Discord**](https://discord.gg/HYwBjTbAY5) to follow current development of the project and seek support.

# Description

*Pe-Fake-Plate* is a **standalone** resource and is not dependent on any framework. This was made due to the absence of a **free** reliable fake plate system that was optimized and didn't contain any exploits. There is **no database changes** within this resource. **Players will have to set their old plate on their vehicle before storing.** If requested, I can add an additional config option for this, but it defeats the purpose of a "Fake Plate". Resource currently runs at `0.0` ms.

![image](https://user-images.githubusercontent.com/55056068/118578285-e06acc80-b759-11eb-8adf-3abca2c784f1.png)


# Preview
[**Click Me!**](https://streamable.com/p388xb)

# Features

- Standalone resource with **optional** ESX integration (Usuable item and item removal/adding).
- Distance check server side to prevent exploiting.
- Changing of plate with animation.
- Fake plate contains a string of 8 letters/numbers so it looks authentic and not `XXXXXXXX`/blank plate like some resources chose to do. (See [**here**](https://i.imgur.com/bEVyXzU.png))
- Debug prints to help with any issues you may have.
- Version checker to ensure you're on the latest version.

*Any configuration is set within ether the [**cl_config.lua**](https://github.com/project-error/pe-fake-plate/blob/main/config/cl_config.lua) or the [**sv_config.lua**](https://github.com/project-error/pe-fake-plate/blob/main/config/sv_config.lua).*

- Config option to change the identifier that is being used easily.
- Config option for [**Mysql-Async**](https://github.com/brouznouf/fivem-mysql-async) **or** [**Ghmattisql**](https://github.com/GHMatti/ghmattimysql).
- Config option for multiple notification systems. ([**T-Notify**](https://github.com/TasoOneAsia/t-notify), [**Mythic-Notify**](https://github.com/FlawwsX/mythic_notify), [**pNotify**](https://forum.cfx.re/t/release-pnotify-in-game-js-notifications-using-noty/20659) and **ESX Notifications**.)
- Config option for [**Mythic Progress Bar**](https://github.com/ONyambura/mythic_progbar) .
- Config option to restrict it to the vehicle owner. (Requires you to set [**Mysql-Async**](https://github.com/brouznouf/fivem-mysql-async) **or** [**Ghmattisql**](https://github.com/GHMatti/ghmattimysql) to true.)
- Config option to allow the player to apply multiple fake plates.

# Dependencies (Optional)

- [Mysql-Async](https://github.com/brouznouf/fivem-mysql-async) **or** [**Ghmattisql**](https://github.com/GHMatti/ghmattimysql) You will need to set the config to `true`/`false` within the [**sv_config.lua**](https://github.com/project-error/pe-fake-plate/blob/main/config/sv_config.lua).
If using `Ghmattisql`, be sure to comment out `'@mysql-async/lib/MySQL.lua',` within the [**fxmanifest**](hhttps://github.com/project-error/pe-fake-plate/blob/faa27fd64019a21f88665af9859f1f4e95204fa0/fxmanifest.lua#L12).

# Supported Notifications

*Pe-Fake-Plate* supports the following notification resources by default:
- [**T-Notify**](https://github.com/TasoOneAsia/t-notify) **(Recomended)** T-Notify offers numerous advantages over any other notification system and has well written [Docs](https://docs.tasoagc.dev/#/). This is the suggested notification system to be used. Please ensure you're on the latest version.
- [**Mythic-Notify**](https://github.com/FlawwsX/mythic_notify) This resource uses `SendAlert` and not the old way of `DoHudText` so this version is **required** if you want to use `Mythic-Notify`.
- [**pNotify**](https://forum.cfx.re/t/release-pnotify-in-game-js-notifications-using-noty/20659) GTA Online styled notification system.
- **ESX Notifications** Basic ESX notifications.

# Supported Progress Bars (Optional)

*Pe-Fake-Plate* supports the following prgress bar resources by default:
- [**Mythic Progress Bar**](https://github.com/ONyambura/mythic_progbar)

If you would like more supported please follow the same code style and PR it.

# Contributing

Please make all pull request towards the [**Dev Branch**](https://github.com/project-error/new-fakeplate-who-dis/tree/dev). If you have any suggestions for improvements please contact `ROCKY_southpaw#6771` on **Discord** or in the [**Project Error Discord**](https://discord.gg/HYwBjTbAY5) or open an issue.
155 changes: 155 additions & 0 deletions client/cl_events.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
local inProgress = inProgress

if Config.esxNotify then
ESX = exports['es_extended']:getSharedObject()
end

RegisterNetEvent('pe-fake-plate:setPlate', function(netId, originalPlate, fakePlate, plateType)
if NetworkDoesEntityExistWithNetworkId(netId) then
local vehicle = NetToVeh(netId)
if fakePlate ~= nil and originalPlate ~= nil then
if not IsPedInAnyVehicle(PlayerPedId(), false) then
if not inProgress then
inProgress = true
if Config.mythicProgressBar then
--TaskTurnPedToFaceEntity(PlayerPedId(), vehicle, -1)
--Wait(500)
exports['mythic_progbar']:Progress({
name = "firstaid_action",
duration = 8000,
label = "Changing plate...",
useWhileDead = false,
canCancel = true,
controlDisables = {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
},
animation = {
animDict = "anim@amb@clubhouse@tutorial@bkr_tut_ig3@",
anim = "machinic_loop_mechandplayer",
flags = 1,
},
}, function(status)
if not status then
if plateType == 'fake' then
SetVehicleNumberPlateText(vehicle, fakePlate)
TriggerServerEvent('plateSuccess', originalPlate, fakePlate, plateType)
elseif plateType == 'return' then
SetVehicleNumberPlateText(vehicle, originalPlate)
TriggerServerEvent('plateSuccess', originalPlate, fakePlate, plateType)
end
inProgress = false
else
inProgress = false
end
end)
else
RequestAnimDict("anim@amb@clubhouse@tutorial@bkr_tut_ig3@")
if not HasAnimDictLoaded("anim@amb@clubhouse@tutorial@bkr_tut_ig3@") then
Wait(100)
end
--TaskTurnPedToFaceEntity(PlayerPedId(), vehicle, -1)
--Wait(500)
TriggerEvent('pe-fake-plate:notifySuccess', 'Applying plate...')
TaskPlayAnim(PlayerPedId(), "anim@amb@clubhouse@tutorial@bkr_tut_ig3@", "machinic_loop_mechandplayer", 1.0, 1.0, 8000, 1, 0, false, false, false)
Wait(7500)
if IsEntityPlayingAnim(PlayerPedId(), "anim@amb@clubhouse@tutorial@bkr_tut_ig3@", "machinic_loop_mechandplayer", 1) then
if plateType == 'fake' then
SetVehicleNumberPlateText(vehicle, fakePlate)
TriggerServerEvent('plateSuccess', originalPlate, fakePlate, plateType)
elseif plateType == 'return' then
SetVehicleNumberPlateText(vehicle, originalPlate)
TriggerServerEvent('plateSuccess', originalPlate, fakePlate, plateType)
end
inProgress = false
else
TriggerEvent('pe-fake-plate:notifyError', 'Animation was cancelled.')
TriggerServerEvent('pe-fake-plate:disableBool', source)
inProgress = false
end
end
else
TriggerEvent('pe-fake-plate:notifyError', 'Action already in progress.')
end
else
TriggerEvent('pe-fake-plate:notifyError', 'Exit the vehicle first!')
TriggerServerEvent('pe-fake-plate:disableBool', source)
end
else
print("Triggered without args")
-- Should be impossible to do.
end
else
print("Tried to access invalid network ID")
end
end)

RegisterNetEvent('pe-fake-plate:notifySuccess')
AddEventHandler('pe-fake-plate:notifySuccess', function(message)
length = Config.successLength * 1000
if Config.tNotify then
exports['t-notify']:Alert({
style = 'success',
message = "✔️ " .. message,
length = length
})
end
if Config.mythicNotify then
exports['mythic_notify']:SendAlert('success', "✔️ " .. message, length)
end
if Config.pNotify then
exports.pNotify:SetQueueMax(id, 1)
exports.pNotify:SendNotification({
text = "✔️ " .. message,
type = "success",
timeout = length,
layout = Config.layout,
theme = Config.theme,
queue = "id"
})
end
if Config.esxNotify then
ESX.ShowNotification(
"✔️ " .. message,
false,
false,
140
)
end
end)

RegisterNetEvent('pe-fake-plate:notifyError')
AddEventHandler('pe-fake-plate:notifyError', function(message)
length = Config.errorLength * 1000
if Config.tNotify then
exports['t-notify']:Alert({
style = 'error',
message = "" .. message,
length = length
})
end
if Config.mythicNotify then
exports['mythic_notify']:SendAlert('error', "" .. message, length)
end
if Config.pNotify then
exports.pNotify:SetQueueMax(id, 1)
exports.pNotify:SendNotification({
text = "" .. message,
type = "error",
timeout = length,
layout = Config.layout,
theme = Config.theme,
queue = "id"
})
end
if Config.esxNotify then
ESX.ShowNotification(
"" .. message,
false,
false,
140
)
end
end)
73 changes: 0 additions & 73 deletions client/cl_main.lua

This file was deleted.

23 changes: 22 additions & 1 deletion config/cl_config.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
Config = {}

Config.mythicProgressBar = false
-- Config Notifications (Applies to All)
Config.successLength = 2 -- Length of success Notification (Seconds)
Config.errorLength = 2 -- Length of error Notification (Seconds)

-- Config Variables (Mythic Progress Bar)
Config.mythicProgressBar = true -- Will still trigger an animation and an alert if set to false.

-- Config Variables (T-Notify)
Config.tNotify = true
Config.tLocation = 'top-right' -- (top-left, top-center, top-right, bottom-left, bottom-center, bottom-right)

-- Config Variables (Mythic Notify)
Config.mythicNotify = false
Config.backgroundColor = '#292929'

-- Config Variables (pNotify)
Config.pNotify = false
Config.layout = "centerRight" -- (top, topLeft, topCenter, topRight, center, cenerLeft, centerRight, bottom, bottomLeft, bottomCenter, bottomRight)
Config.theme = "gta" -- gta, mint, relax, metroui

-- Config Variables (ESX Notification)
Config.esxNotify = false
13 changes: 9 additions & 4 deletions config/sv_config.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
Config = {}

Config.dropPlayer = true -- Drops player if their client and server plates are not the same.
-- Config Variables (Database)
Config.useMysqlAsync = true
Config.useGhmattimysql = false
Config.Identifier = 'license:'
Config.databaseName = 'ngwd_vehicles'
Config.databaseName = 'owned_vehicles'

-- Config Variables (Framework)
Config.Standalone = true
Config.useESX = false

-- Config Variables (Plates)
Config.ownerRestricted = false -- Only allow vehicle owner to apply fake plate.
Config.restrictCommands = true
Config.allowMultipleFakes = true
Config.restrictCommands = false
Config.allowMultipleFakes = false -- Lets players use fake plates more than once.

-- Config Variables (Debug)
Debug = {}
Expand Down Expand Up @@ -42,4 +47,4 @@ Debug Classess
^7 Default
^8 Dark Red
^9 Dark Blue
]]
]]
5 changes: 3 additions & 2 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ fx_version 'cerulean'

game { 'gta5' }

description 'Reanimation Weeb Plate'
description 'Project Error Fake Plate'

version '1.0.0'

Expand All @@ -20,5 +20,6 @@ client_scripts {
}

dependencies {
'mysql-async'
--'mysql-async', -- https://github.com/brouznouf/fivem-mysql-async
--'ghmattimysql', -- https://github.com/GHMatti/ghmattimysql
}
2 changes: 2 additions & 0 deletions item.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`,`price`) VALUES ('plate', 'Vehicle Plate', 1, 0, 1, 1);
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`,`price`) VALUES ('fakeplate', 'Fake Vehicle Plate', 1, 0, 1, 1);
Loading

0 comments on commit ace9e3e

Please sign in to comment.