-
-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #865 from esx-framework/dev
1.9.1
Showing
19 changed files
with
392 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
local isInVehicle, isEnteringVehicle, isJumping, inPauseMenu = false, false, false, false | ||
local currentVehicle, currentSeat, currentPlate = nil, nil, nil | ||
local playerPed = PlayerPedId() | ||
|
||
local function GetPedVehicleSeat(ped, vehicle) | ||
for i = -1, 16 do | ||
if (GetPedInVehicleSeat(vehicle, i) == ped) then return i end | ||
end | ||
return -1 | ||
end | ||
|
||
local function GetData(vehicle) | ||
local model = GetEntityModel(currentVehicle) | ||
local displayName = GetDisplayNameFromVehicleModel(model) | ||
local netId = VehToNet(vehicle) | ||
return displayName, netId | ||
end | ||
|
||
CreateThread(function() | ||
while true do | ||
|
||
if playerPed ~= PlayerPedId() then | ||
playerPed = PlayerPedId() | ||
TriggerEvent('esx:playerPedChanged', playerPed) | ||
TriggerServerEvent('esx:playerPedChanged', PedToNet(playerPed)) | ||
end | ||
|
||
if IsPedJumping(playerPed) and not isJumping then | ||
isJumping = true | ||
TriggerEvent('esx:playerJumping') | ||
TriggerServerEvent('esx:playerJumping') | ||
elseif not IsPedJumping(playerPed) and isJumping then | ||
isJumping = false | ||
end | ||
|
||
if IsPauseMenuActive() and not inPauseMenu then | ||
inPauseMenu = true | ||
TriggerEvent('esx:pauseMenuActive', inPauseMenu) | ||
elseif not IsPauseMenuActive() and inPauseMenu then | ||
inPauseMenu = false | ||
TriggerEvent('esx:pauseMenuActive', inPauseMenu) | ||
end | ||
|
||
|
||
if not isInVehicle and not IsPlayerDead(PlayerId()) then | ||
if DoesEntityExist(GetVehiclePedIsTryingToEnter(playerPed)) and not isEnteringVehicle then | ||
-- trying to enter a vehicle! | ||
local vehicle = GetVehiclePedIsTryingToEnter(playerPed) | ||
local plate = GetVehicleNumberPlateText(vehicle) | ||
local seat = GetSeatPedIsTryingToEnter(playerPed) | ||
local displayName, netId = GetData(vehicle) | ||
isEnteringVehicle = true | ||
TriggerEvent('esx:enteringVehicle', vehicle, plate, seat, netId) | ||
TriggerServerEvent('esx:enteringVehicle', vehicle, plate, seat, netId) | ||
elseif not DoesEntityExist(GetVehiclePedIsTryingToEnter(playerPed)) and | ||
not IsPedInAnyVehicle(playerPed, true) and isEnteringVehicle then | ||
-- vehicle entering aborted | ||
TriggerEvent('esx:enteringVehicleAborted') | ||
TriggerServerEvent('esx:enteringVehicleAborted') | ||
isEnteringVehicle = false | ||
elseif IsPedInAnyVehicle(playerPed, false) then | ||
-- suddenly appeared in a vehicle, possible teleport | ||
isEnteringVehicle = false | ||
isInVehicle = true | ||
currentVehicle = GetVehiclePedIsUsing(playerPed) | ||
currentSeat = GetPedVehicleSeat(playerPed, currentVehicle) | ||
currentPlate = GetVehicleNumberPlateText(currentVehicle) | ||
local displayName, netId = GetData(currentVehicle) | ||
TriggerEvent('esx:enteredVehicle', currentVehicle, currentPlate, currentSeat, displayName, netId) | ||
TriggerServerEvent('esx:enteredVehicle', currentVehicle, currentPlate, currentSeat, displayName, netId) | ||
end | ||
elseif isInVehicle then | ||
if not IsPedInAnyVehicle(playerPed, false) or IsPlayerDead(PlayerId()) then | ||
-- bye, vehicle | ||
local displayName, netId = GetData(currentVehicle) | ||
TriggerEvent('esx:exitedVehicle', currentVehicle, currentPlate, currentSeat, displayName, netId) | ||
TriggerServerEvent('esx:exitedVehicle', currentVehicle, currentPlate, currentSeat, displayName, netId) | ||
isInVehicle = false | ||
currentVehicle = nil | ||
currentSeat = nil | ||
currentPlate = nil | ||
end | ||
end | ||
Wait(200) | ||
end | ||
end) | ||
|
||
if Config.EnableDebug then | ||
|
||
AddEventHandler('esx:playerPedChanged', function(netId) | ||
print('esx:playerPedChanged', netId) | ||
end) | ||
|
||
AddEventHandler('esx:playerJumping', function() | ||
print('esx:playerJumping') | ||
end) | ||
|
||
AddEventHandler('esx:enteringVehicle', function(vehicle, plate, seat, netId) | ||
print('esx:enteringVehicle', 'vehicle', vehicle, 'plate', plate, 'seat', seat, 'netId', netId) | ||
end) | ||
|
||
AddEventHandler('esx:enteringVehicleAborted', function() | ||
print('esx:enteringVehicleAborted') | ||
end) | ||
|
||
AddEventHandler('esx:enteredVehicle', function(vehicle, plate, seat, displayName, netId) | ||
print('esx:enteredVehicle', 'vehicle', vehicle, 'plate', plate, 'seat', seat, 'displayName', displayName, 'netId', netId) | ||
end) | ||
|
||
AddEventHandler('esx:exitedVehicle', function(vehicle, plate, seat, displayName, netId) | ||
print('esx:exitedVehicle', 'vehicle', vehicle, 'plate', plate, 'seat', seat, 'displayName', displayName, 'netId', netId) | ||
end) | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
local npwd = GetResourceState('npwd'):find('start') and exports.npwd or nil | ||
|
||
local function checkPhone() | ||
if not npwd then | ||
return | ||
end | ||
|
||
npwd:setPhoneDisabled((ESX.SearchInventory('phone').count or 0) <= 0) | ||
end | ||
RegisterNetEvent('esx:playerLoaded', checkPhone) | ||
|
||
AddEventHandler('onClientResourceStart', function(resource) | ||
if resource ~= 'npwd' then | ||
return | ||
end | ||
|
||
npwd = GetResourceState('npwd'):find('start') and exports.npwd or nil | ||
|
||
if ESX.PlayerLoaded then | ||
checkPhone() | ||
end | ||
end) | ||
|
||
AddEventHandler('onClientResourceStop', function(resource) | ||
if resource == 'npwd' then | ||
npwd = nil | ||
end | ||
end) | ||
|
||
RegisterNetEvent('esx:onPlayerLogout', function() | ||
if not npwd then | ||
return | ||
end | ||
|
||
npwd:setPhoneVisible(false) | ||
npwd:setPhoneDisabled(true) | ||
end) | ||
|
||
RegisterNetEvent('esx:removeInventoryItem', function(item, count) | ||
if not npwd then | ||
return | ||
end | ||
|
||
if item == 'phone' and count == 0 then | ||
npwd:setPhoneDisabled(true) | ||
end | ||
end) | ||
|
||
RegisterNetEvent('esx:addInventoryItem', function(item) | ||
if not npwd or item ~= 'phone' then | ||
return | ||
end | ||
|
||
npwd:setPhoneDisabled(false) | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,75 @@ | ||
@font-face { | ||
font-family: 'Pricedown'; | ||
src: url('../fonts/pdown.ttf') | ||
font-family: 'Pricedown'; | ||
src: url('../fonts/pdown.ttf'); | ||
} | ||
|
||
@font-face { | ||
font-family: 'bankgothic'; | ||
src: url('../fonts/bankgothic.ttf') | ||
font-family: 'bankgothic'; | ||
src: url('../fonts/bankgothic.ttf'); | ||
} | ||
|
||
html { | ||
overflow: hidden; | ||
} | ||
|
||
#hud { | ||
opacity: 0.0; | ||
position: absolute; | ||
font-family: 'Pricedown'; | ||
font-size: 35px; | ||
color: white; | ||
padding: 4px; | ||
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; | ||
text-align: right; | ||
top: 80; | ||
right: 40; | ||
overflow: hidden; | ||
} | ||
|
||
#inventory_notifications { | ||
font-family: bankgothic; | ||
position: absolute; | ||
right: 40; | ||
bottom: 40; | ||
font-size: 2em; | ||
font-weight: bold; | ||
color: #FFF; | ||
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; | ||
font-family: bankgothic; | ||
position: absolute; | ||
right: 40; | ||
bottom: 40; | ||
font-size: 2em; | ||
font-weight: bold; | ||
color: #fff; | ||
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; | ||
} | ||
|
||
.menu { | ||
font-family: 'Open Sans', sans-serif; | ||
min-width: 400px; | ||
min-height: 250px; | ||
color: #fff; | ||
position: absolute; | ||
left: 40; | ||
top: 0; | ||
font-family: 'Open Sans', sans-serif; | ||
min-width: 400px; | ||
min-height: 250px; | ||
color: #fff; | ||
position: absolute; | ||
left: 40; | ||
top: 0; | ||
} | ||
|
||
.menu .head { | ||
font-family: 'Open Sans', sans-serif; | ||
font-size: 28px; | ||
padding: 10px; | ||
background: #1A1A1A; | ||
border-bottom: 3px solid #BC1635; | ||
border-radius: 10px 10px 0 0; | ||
-webkit-border-radius: 10px 10px 0 0; | ||
-moz-border-radius: 10px 10px 0 0; | ||
-o-border-radius: 10px 10px 0 0; | ||
box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.28); | ||
-webkit-box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.28); | ||
-moz-box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.28); | ||
-o-box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.28); | ||
box-shadow: 1px 1px 10px 4px rgba(0, 0, 0, 0.4); | ||
font-family: 'Open Sans', sans-serif; | ||
font-size: 28px; | ||
padding: 10px; | ||
background: #1a1a1a; | ||
border-bottom: 3px solid #bc1635; | ||
border-radius: 10px 10px 0 0; | ||
-webkit-border-radius: 10px 10px 0 0; | ||
-moz-border-radius: 10px 10px 0 0; | ||
-o-border-radius: 10px 10px 0 0; | ||
box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.28); | ||
-webkit-box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.28); | ||
-moz-box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.28); | ||
-o-box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.28); | ||
box-shadow: 1px 1px 10px 4px rgba(0, 0, 0, 0.4); | ||
} | ||
|
||
.menu .head span { | ||
font-family: 'Pricedown'; | ||
font-size: 28px; | ||
padding-left: 15px; | ||
padding-top: 6px; | ||
font-family: 'Pricedown'; | ||
font-size: 28px; | ||
padding-left: 15px; | ||
padding-top: 6px; | ||
} | ||
|
||
.menu .menu-items .menu-item { | ||
font-family: 'Open Sans', sans-serif; | ||
font-size: 14px; | ||
height: 40px; | ||
display: block; | ||
background-color: #f1f1f1; | ||
box-shadow: inset 1px 0px 0px 1px #b8b8b8; | ||
height: 32px; | ||
line-height: 32px; | ||
color: #3A3A3A; | ||
text-align: center; | ||
font-family: 'Open Sans', sans-serif; | ||
font-size: 14px; | ||
height: 40px; | ||
display: block; | ||
background-color: #f1f1f1; | ||
box-shadow: inset 1px 0px 0px 1px #b8b8b8; | ||
height: 32px; | ||
line-height: 32px; | ||
color: #3a3a3a; | ||
text-align: center; | ||
} | ||
|
||
.menu .menu-items .menu-item.selected { | ||
background-color: #ccc; | ||
background-color: #ccc; | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="css/app.css" /> | ||
</head> | ||
<body> | ||
|
||
<div id="hud"></div> | ||
<div id="inventory_notifications"></div> | ||
<head> | ||
<link rel="stylesheet" href="css/app.css" /> | ||
</head> | ||
<body> | ||
<div id="inventory_notifications"></div> | ||
|
||
<script src="nui://game/ui/jquery.js" type="text/javascript"></script> | ||
<script src="js/mustache.min.js"></script> | ||
<script src="js/app.js"></script> | ||
</body> | ||
</html> | ||
<script src="nui://game/ui/jquery.js" type="text/javascript"></script> | ||
<script src="js/mustache.min.js"></script> | ||
<script src="js/app.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
RegisterServerEvent('esx:playerPedChanged') | ||
RegisterServerEvent('esx:playerJumping') | ||
RegisterServerEvent('esx:enteringVehicle') | ||
RegisterServerEvent('esx:enteringVehicleAborted') | ||
RegisterServerEvent('esx:enteredVehicle') | ||
RegisterServerEvent('esx:exitedVehicle') | ||
|
||
if Config.EnableDebug then | ||
|
||
AddEventHandler('esx:playerPedChanged', function(netId) | ||
print('esx:playerPedChanged', source, netId) | ||
end) | ||
|
||
AddEventHandler('esx:playerJumping', function() | ||
print('esx:playerJumping', source) | ||
end) | ||
|
||
AddEventHandler('esx:enteringVehicle', function(vehicle, plate, seat, netId) | ||
print('esx:enteringVehicle', 'source', source, 'vehicle', vehicle, 'plate', plate, 'seat', seat, 'netId', netId) | ||
end) | ||
|
||
AddEventHandler('esx:enteringVehicleAborted', function() | ||
print('esx:enteringVehicleAborted', source) | ||
end) | ||
|
||
AddEventHandler('esx:enteredVehicle', function(vehicle, plate, seat, displayName, netId) | ||
print('esx:enteredVehicle', 'source', source, 'vehicle', vehicle, 'plate', plate, 'seat', seat, 'displayName', displayName, 'netId', netId) | ||
end) | ||
|
||
AddEventHandler('esx:exitedVehicle', function(vehicle, plate, seat, displayName, netId) | ||
print('esx:exitedVehicle', 'source', source, 'vehicle', vehicle, 'plate', plate, 'seat', seat, 'displayName', displayName, 'netId', netId) | ||
end) | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
local npwd = GetResourceState('npwd'):find('start') and exports.npwd or nil | ||
|
||
AddEventHandler('onServerResourceStart', function(resource) | ||
if resource ~= 'npwd' then | ||
return | ||
end | ||
|
||
npwd = GetResourceState('npwd'):find('start') and exports.npwd or nil | ||
|
||
for _, xPlayer in pairs(ESX.Players) do | ||
npwd:newPlayer({ | ||
source = xPlayer.source, | ||
identifier = xPlayer.identifier, | ||
firstname = xPlayer.get('firstName'), | ||
lastname = xPlayer.get('lastName') | ||
}) | ||
end | ||
end) | ||
|
||
AddEventHandler('onServerResourceStop', function(resource) | ||
if resource == 'npwd' then | ||
npwd = nil | ||
end | ||
end) | ||
|
||
AddEventHandler('esx:playerLoaded', function(playerId, xPlayer) | ||
if not npwd then | ||
return | ||
end | ||
|
||
if not xPlayer then | ||
xPlayer = ESX.GetPlayerFromId(playerId) | ||
end | ||
|
||
npwd:newPlayer({ | ||
source = playerId, | ||
identifier = xPlayer.identifier, | ||
firstname = xPlayer.get('firstName'), | ||
lastname = xPlayer.get('lastName') | ||
}) | ||
end) | ||
|
||
AddEventHandler('esx:playerLogout', function(playerId) | ||
if not npwd then | ||
return | ||
end | ||
|
||
npwd:unloadPlayer(playerId) | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters