Initial edits for ES5

This commit is contained in:
ElPumpo
2018-04-15 12:23:40 +02:00
parent 99f186b8b2
commit cb68068cb7
11 changed files with 103 additions and 203 deletions
-9
View File
@@ -1,9 +0,0 @@
root = true
[*]
indent_size = 2
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
-2
View File
@@ -1,2 +0,0 @@
# Auto detect text files and perform LF normalization
* text=auto
View File
+3 -6
View File
@@ -17,18 +17,15 @@ This version is not compatible with ES5, use [esx_identity_es5](https://github.c
3) Add this in your server.cfg :
Notice:
`If you were already using the latest version of esx_identity before the update, you can just import esx_identity_update.sql`
```
start esx_identity
```
4) If you are using esx_policejob or esx_society, you need to enable the following in the files config.lua:
```Config.EnableESXIdentity = true```
### Commands
```
Commands:
/identityhelp
/register
/charlist
@@ -37,4 +34,4 @@ Commands:
```
### License
This script is licensed under GPLv3, see the [license](license.txt)
This script is licensed under GPLv3, see the [license](LICENSE)
+20 -11
View File
@@ -1,15 +1,24 @@
version '1.0.2'
-- https://wiki.fivem.net/wiki/Resource_manifest
client_script('client.lua')
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
server_script "@mysql-async/lib/MySQL.lua"
server_script "server.lua"
description 'ESX Identity'
ui_page('html/index.html')
version '1.0.4'
files({
'html/index.html',
'html/script.js',
'html/style.css',
'html/cursor.png',
})
client_script 'client/main.lua'
server_scripts {
"@mysql-async/lib/MySQL.lua",
"@es_extended/locale.lua",
"server/main.lua",
}
ui_page 'html/index.html'
files {
'html/index.html',
'html/script.js',
'html/style.css',
'html/cursor.png',
}
-75
View File
@@ -1,75 +0,0 @@
--==================================================================================
--====== ESX_IDENTITY BY ARKSEYONET @Ark ======
--====== YOU CAN FIND ME ON MY DISCORD @Ark - https://discord.gg/cGHHxPX ======
--====== IF YOU ALTER THIS VERSION OF THE SCRIPT, PLEASE GIVE ME CREDIT ======
--====== Special Thanks To Alphakush and CMD.Telhada For Help Testing ======
--==================================================================================
--===============================================
--== VARIABLES ==
--===============================================
local guiEnabled = false
local myIdentity = {}
--===============================================
--== VARIABLES ==
--===============================================
function EnableGui(enable)
SetNuiFocus(enable)
guiEnabled = enable
SendNUIMessage({
type = "enableui",
enable = enable
})
end
--===============================================
--== Show Registration ==
--===============================================
RegisterNetEvent("esx_identity:showRegisterIdentity")
AddEventHandler("esx_identity:showRegisterIdentity", function()
EnableGui(true)
end)
--===============================================
--== Close GUI ==
--===============================================
RegisterNUICallback('escape', function(data, cb)
EnableGui(false)
end)
--===============================================
--== Register Callback ==
--===============================================
RegisterNUICallback('register', function(data, cb)
myIdentity = data
TriggerServerEvent('esx_identity:setIdentity', data)
EnableGui(false)
Wait (500)
TriggerEvent('esx_skin:openSaveableMenu')
end)
--===============================================
--== THREADING ==
--===============================================
Citizen.CreateThread(function()
while true do
if guiEnabled then
DisableControlAction(0, 1, guiEnabled) -- LookLeftRight
DisableControlAction(0, 2, guiEnabled) -- LookUpDown
DisableControlAction(0, 142, guiEnabled) -- MeleeAttackAlternate
DisableControlAction(0, 106, guiEnabled) -- VehicleMouseControlOverride
if IsDisabledControlJustReleased(0, 142) then -- MeleeAttackAlternate
SendNUIMessage({
type = "click"
})
end
end
Citizen.Wait(0)
end
end)
+46
View File
@@ -0,0 +1,46 @@
local guiEnabled = false
local myIdentity = {}
function EnableGui(enable)
SetNuiFocus(enable)
guiEnabled = enable
SendNUIMessage({
type = "enableui",
enable = enable
})
end
RegisterNetEvent("esx_identity:showRegisterIdentity")
AddEventHandler("esx_identity:showRegisterIdentity", function()
EnableGui(true)
end)
RegisterNUICallback('escape', function(data, cb)
EnableGui(false)
end)
RegisterNUICallback('register', function(data, cb)
myIdentity = data
TriggerServerEvent('esx_identity:setIdentity', data)
EnableGui(false)
Citizen.Wait(500)
TriggerEvent('esx_skin:openSaveableMenu')
end)
Citizen.CreateThread(function()
while true do
if guiEnabled then
DisableControlAction(0, 1, guiEnabled) -- LookLeftRight
DisableControlAction(0, 2, guiEnabled) -- LookUpDown
DisableControlAction(0, 142, guiEnabled) -- MeleeAttackAlternate
DisableControlAction(0, 106, guiEnabled) -- VehicleMouseControlOverride
if IsDisabledControlJustReleased(0, 142) then -- MeleeAttackAlternate
SendNUIMessage({
type = "click"
})
end
end
Citizen.Wait(10)
end
end)
+5 -5
View File
@@ -1,11 +1,11 @@
USE `essentialmode`;
ALTER TABLE `users`
ADD COLUMN `firstname` VARCHAR(50) NULL DEFAULT '',
ADD COLUMN `lastname` VARCHAR(50) NULL DEFAULT '',
ADD COLUMN `dateofbirth` VARCHAR(25) NULL DEFAULT '',
ADD COLUMN `sex` VARCHAR(10) NULL DEFAULT '',
ADD COLUMN `height` VARCHAR(5) NULL DEFAULT ''
ADD COLUMN `firstname` VARCHAR(50) NULL DEFAULT '',
ADD COLUMN `lastname` VARCHAR(50) NULL DEFAULT '',
ADD COLUMN `dateofbirth` VARCHAR(25) NULL DEFAULT '',
ADD COLUMN `sex` VARCHAR(10) NULL DEFAULT '',
ADD COLUMN `height` VARCHAR(5) NULL DEFAULT ''
;
CREATE TABLE `characters` (
-11
View File
@@ -1,11 +0,0 @@
USE `essentialmode`;
CREATE TABLE `characters` (
`identifier` varchar(255) NOT NULL,
`firstname` varchar(255) NOT NULL,
`lastname` varchar(255) NOT NULL,
`dateofbirth` varchar(255) NOT NULL,
`sex` varchar(1) NOT NULL DEFAULT 'f',
`height` varchar(128) NOT NULL
);
+29 -29
View File
@@ -1,52 +1,52 @@
body {
font-family: sans-serif;
overflow: hidden;
display: none;
font-family: sans-serif;
overflow: hidden;
display: none;
}
#cursor {
position: absolute;
z-index: 999999;
display: none;
position: absolute;
z-index: 999999;
display: none;
}
.dialog {
width: 300px;
position: absolute;
left: 50%;
transform: translateX(-50%);
padding: 10px;
background-color: rgba(0, 0, 0, 0.5);
width: 300px;
position: absolute;
left: 50%;
transform: translateX(-50%);
padding: 10px;
background-color: rgba(0, 0, 0, 0.5);
}
form {
margin: 0;
margin: 0;
}
input[type=text] {
width: 100%;
padding: 10px;
width: 100%;
padding: 10px;
text-align: center;
}
button {
display: block;
margin-top: 5px;
padding: 10px;
background-color: Blue;
border: 0;
color: #fff;
width: 100%;
display: block;
margin-top: 5px;
padding: 10px;
background-color: Blue;
border: 0;
color: #fff;
width: 100%;
}
h1 {
display: block;
margin-top: 5px;
display: block;
margin-top: 5px;
margin-right: 5px;
padding: 10px;
background-color: Blue;
border: 0;
color: #fff;
width: 93%;
padding: 10px;
background-color: Blue;
border: 0;
color: #fff;
width: 93%;
text-align: center;
}
-55
View File
@@ -1,18 +1,3 @@
--==================================================================================
--====== ESX_IDENTITY BY ARKSEYONET @Ark ======
--====== YOU CAN FIND ME ON MY DISCORD @Ark - https://discord.gg/cGHHxPX ======
--====== IF YOU ALTER THIS VERSION OF THE SCRIPT, PLEASE GIVE ME CREDIT ======
--====== Special Thanks To COSHAREK FOR THE UI Design ======
--====== Special Thanks To Alphakush and CMD.Telhada For Help Testing ======
--==================================================================================
--===================================================================
--== MAIN FUNCTIONS ==
--===================================================================
--===============================================
--== Get The Player's Identification ==
--===============================================
function getIdentity(source, callback)
local identifier = GetPlayerIdentifiers(source)[1]
MySQL.Async.fetchAll("SELECT * FROM `users` WHERE `identifier` = @identifier",
@@ -46,9 +31,6 @@ function getIdentity(source, callback)
end)
end
--===============================================
--== Get The Player's Identification ==
--===============================================
function getCharacters(source, callback)
local identifier = GetPlayerIdentifiers(source)[1]
MySQL.Async.fetchAll("SELECT * FROM `characters` WHERE `identifier` = @identifier",
@@ -144,9 +126,6 @@ function getCharacters(source, callback)
end)
end
--===============================================
--== Set The Player's Identification ==
--===============================================
function setIdentity(identifier, data, callback)
MySQL.Async.execute("UPDATE `users` SET `firstname` = @firstname, `lastname` = @lastname, `dateofbirth` = @dateofbirth, `sex` = @sex, `height` = @height WHERE identifier = @identifier",
{
@@ -175,9 +154,6 @@ function setIdentity(identifier, data, callback)
})
end
--===============================================
--== Update The Player's Identification ==
--===============================================
function updateIdentity(identifier, data, callback)
MySQL.Async.execute("UPDATE `users` SET `firstname` = @firstname, `lastname` = @lastname, `dateofbirth` = @dateofbirth, `sex` = @sex, `height` = @height WHERE identifier = @identifier",
{
@@ -195,9 +171,6 @@ function updateIdentity(identifier, data, callback)
end)
end
--===============================================
--== Delete The Player's Identification ==
--===============================================
function deleteIdentity(identifier, data, callback)
MySQL.Async.execute("DELETE FROM `characters` WHERE identifier = @identifier AND firstname = @firstname AND lastname = @lastname AND dateofbirth = @dateofbirth AND sex = @sex AND height = @height",
{
@@ -215,9 +188,6 @@ function deleteIdentity(identifier, data, callback)
end)
end
--===============================================
--== Server Event Set Identity ==
--===============================================
RegisterServerEvent('esx_identity:setIdentity')
AddEventHandler('esx_identity:setIdentity', function(data)
local identifier = GetPlayerIdentifiers(source)[1]
@@ -230,9 +200,6 @@ AddEventHandler('esx_identity:setIdentity', function(data)
end)
end)
--===============================================
--== Player Loaded Event Handler ==
--===============================================
AddEventHandler('es:playerLoaded', function(source)
getIdentity(source, function(data)
if data.firstname == '' then
@@ -243,13 +210,6 @@ AddEventHandler('es:playerLoaded', function(source)
end)
end)
--===================================================================
--== MAIN COMMANDS ==
--===================================================================
--===============================================
--== /charlist - Show Your Characters ==
--===============================================
TriggerEvent('es:addGroupCommand', 'idhelp', "user", function(source, args, user)
TriggerClientEvent('chatMessage', source, 'IDHelp', {255, 0, 0}, "ESX_IDENTITY Commands")
TriggerClientEvent('chatMessage', source, 'IDHelp', {255, 0, 0}, "/register - Register A New Character")
@@ -261,9 +221,6 @@ end, function(source, args, user)
end, {help = "List Your Characters"})
--===============================================
--== /register - Open Registration ==
--===============================================
TriggerEvent('es:addCommand', 'register', function(source, args, user)
getCharacters(source, function(data)
if data.firstname3 ~= '' then
@@ -274,9 +231,6 @@ TriggerEvent('es:addCommand', 'register', function(source, args, user)
end)
end)
--===============================================
--== /char - Show Active Character ==
--===============================================
TriggerEvent('es:addGroupCommand', 'char', "user", function(source, args, user)
getIdentity(source, function(data)
if data.firstname == '' then
@@ -289,9 +243,6 @@ end, function(source, args, user)
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficienct permissions!")
end, {help = "List Your Current Active Character"})
--===============================================
--== /charlist - Show Your Characters ==
--===============================================
TriggerEvent('es:addGroupCommand', 'charlist', "user", function(source, args, user)
getCharacters(source, function(data)
if data.firstname1 ~= '' then
@@ -310,9 +261,6 @@ end, function(source, args, user)
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficienct permissions!")
end, {help = "List Your Characters"})
--===============================================
--== /charselect 1,2,3 Select Your Active Char ==
--===============================================
TriggerEvent('es:addCommand', 'charselect', function(source, args, user)
table.remove(args, 1)
local charNumber = tonumber(table.concat(args, " "))
@@ -387,9 +335,6 @@ TriggerEvent('es:addCommand', 'charselect', function(source, args, user)
end)
end)
--===============================================
--== /charselect 1,2,3 Select Your Active Char ==
--===============================================
TriggerEvent('es:addCommand', 'delchar', function(source, args, user)
table.remove(args, 1)
local charNumber = tonumber(table.concat(args, " "))