Skip to content
This repository was archived by the owner on Jan 1, 2021. It is now read-only.

Commit 0684215

Browse files
committed
v1.0
1 parent 37d1dbf commit 0684215

File tree

337 files changed

+40018
-31
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

337 files changed

+40018
-31
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ LINK DO ESX-ORG:
1212
| esx_menu_default | 1.0.3 |
1313
| esx_menu_dialog | 1.1.0 |
1414
| esx_menu_list | 1.0.1 |
15-
| esx_menu_default-1.0.3 | Show file differences that haven't been staged |
16-
| esx_menu_default-1.0.3 | Show file differences that haven't been staged |
15+
| pozostałe zasoby nieuwzględnione na liście | 10.01.2019 |
16+
1717

1818
### Paczka Pluginów RolePlay do ESX, gotowych żeby wystarować serwer w pare sekund.
1919

@@ -27,7 +27,7 @@ Pluginy ESX są często update'owane, wiec po pobraniu mojej paczki upewnij sie
2727
4. Zedytuj server.cfg do twoich ustawien serwera (np. Nazwa / IP / Logo)
2828
5. Odpal Serwer!!
2929

30-
Jeżeli masz pytania, problemy lub potrzebujesz pomocy, napisz do mnie na [discord](https://discord.gg/thc7bYW)
30+
Jeżeli masz pytania, problemy lub potrzebujesz pomocy, napisz na odpowiednim kanale na moim serwerze [discord](https://discord.gg/thc7bYW)
3131

3232
### Paczka nie posiada plików serwerowych gdyż te zależne są od wybranego systemu operacyjnego serwera
3333

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_size = 4
5+
indent_style = tab
6+
end_of_line = crlf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

server-data/resources/[esx]/esx_accessories/LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# esx_accessories
2+
3+
Shops with accessories (hat/helmet, glasses, masks, ears accessories). You can put on or take off the accessories with a menu. Accessories saved in database.
4+
5+
/!\ Works only with accessories purchased in the special areas of the clothing store, not via the esx_clotheshop script.
6+
7+
## Requirements
8+
- [esx_skin](https://github.com/ESX-Org/esx_skin)
9+
- [esx_datastore](https://github.com/ESX-Org/esx_datastore)
10+
11+
## Download & Installation
12+
13+
### Using [fvm](https://github.com/qlaffont/fvm-installer)
14+
```
15+
fvm install --save --folder=esx esx-org/esx_accessories
16+
```
17+
18+
### Using Git
19+
```
20+
cd resources
21+
git clone https://github.com/ESX-Org/esx_accessories [esx]/esx_accessories
22+
```
23+
24+
### Manually
25+
- Download https://github.com/ESX-Org/esx_accessories/archive/master.zip
26+
- Put it in the `[esx]` directory
27+
28+
## Installation
29+
- Import `esx_accessories.sql` in your database
30+
- Add this in your `server.cfg`:
31+
32+
```
33+
start esx_accessories
34+
```
35+
36+
# Legal
37+
### License
38+
esx_accessories - buy some shiny stuff!
39+
40+
Copyright (C) 2015-2018 Jérémie N'gadi
41+
42+
This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version.
43+
44+
This program Is distributed In the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty Of MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License For more details.
45+
46+
You should have received a copy Of the GNU General Public License along with this program. If Not, see http://www.gnu.org/licenses/.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
2+
3+
description 'ESX Accessories'
4+
5+
version '1.1.0'
6+
7+
server_scripts {
8+
'@es_extended/locale.lua',
9+
'locales/en.lua',
10+
'locales/fi.lua',
11+
'locales/fr.lua',
12+
'locales/sv.lua',
13+
'locales/cs.lua',
14+
'locales/pl.lua',
15+
'config.lua',
16+
'server/main.lua'
17+
}
18+
19+
client_scripts {
20+
'@es_extended/locale.lua',
21+
'locales/en.lua',
22+
'locales/fi.lua',
23+
'locales/fr.lua',
24+
'locales/sv.lua',
25+
'locales/cs.lua',
26+
'locales/pl.lua',
27+
'config.lua',
28+
'client/main.lua'
29+
}
30+
31+
dependencies {
32+
'es_extended',
33+
'esx_skin',
34+
'esx_datastore'
35+
}
Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
local Keys = {
2+
["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
3+
["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
4+
["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
5+
["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
6+
["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
7+
["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
8+
["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
9+
["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
10+
["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
11+
}
12+
13+
ESX = nil
14+
local HasAlreadyEnteredMarker = false
15+
local LastZone = nil
16+
local CurrentAction = nil
17+
local CurrentActionMsg = ''
18+
local CurrentActionData = {}
19+
local isDead = false
20+
21+
Citizen.CreateThread(function()
22+
while ESX == nil do
23+
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
24+
Citizen.Wait(0)
25+
end
26+
end)
27+
28+
function OpenAccessoryMenu()
29+
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'set_unset_accessory',
30+
{
31+
title = _U('set_unset'),
32+
align = 'top-left',
33+
elements = {
34+
{label = _U('helmet'), value = 'Helmet'},
35+
{label = _U('ears'), value = 'Ears'},
36+
{label = _U('mask'), value = 'Mask'},
37+
{label = _U('glasses'), value = 'Glasses'}
38+
}
39+
}, function(data, menu)
40+
menu.close()
41+
SetUnsetAccessory(data.current.value)
42+
43+
end, function(data, menu)
44+
menu.close()
45+
end)
46+
end
47+
48+
function SetUnsetAccessory(accessory)
49+
ESX.TriggerServerCallback('esx_accessories:get', function(hasAccessory, accessorySkin)
50+
local _accessory = string.lower(accessory)
51+
52+
if hasAccessory then
53+
TriggerEvent('skinchanger:getSkin', function(skin)
54+
local mAccessory = -1
55+
local mColor = 0
56+
57+
if _accessory == "mask" then
58+
mAccessory = 0
59+
end
60+
61+
if skin[_accessory .. '_1'] == mAccessory then
62+
mAccessory = accessorySkin[_accessory .. '_1']
63+
mColor = accessorySkin[_accessory .. '_2']
64+
end
65+
66+
local accessorySkin = {}
67+
accessorySkin[_accessory .. '_1'] = mAccessory
68+
accessorySkin[_accessory .. '_2'] = mColor
69+
TriggerEvent('skinchanger:loadClothes', skin, accessorySkin)
70+
end)
71+
else
72+
ESX.ShowNotification(_U('no_' .. _accessory))
73+
end
74+
75+
end, accessory)
76+
end
77+
78+
function OpenShopMenu(accessory)
79+
local _accessory = string.lower(accessory)
80+
local restrict = {}
81+
82+
restrict = { _accessory .. '_1', _accessory .. '_2' }
83+
84+
TriggerEvent('esx_skin:openRestrictedMenu', function(data, menu)
85+
86+
menu.close()
87+
88+
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'shop_confirm',
89+
{
90+
title = _U('valid_purchase'),
91+
align = 'top-left',
92+
elements = {
93+
{label = _U('no'), value = 'no'},
94+
{label = _U('yes', ESX.Math.GroupDigits(Config.Price)), value = 'yes'}
95+
}
96+
}, function(data, menu)
97+
menu.close()
98+
if data.current.value == 'yes' then
99+
ESX.TriggerServerCallback('esx_accessories:checkMoney', function(hasEnoughMoney)
100+
if hasEnoughMoney then
101+
TriggerServerEvent('esx_accessories:pay')
102+
TriggerEvent('skinchanger:getSkin', function(skin)
103+
TriggerServerEvent('esx_accessories:save', skin, accessory)
104+
end)
105+
else
106+
TriggerEvent('esx_skin:getLastSkin', function(skin)
107+
TriggerEvent('skinchanger:loadSkin', skin)
108+
end)
109+
ESX.ShowNotification(_U('not_enough_money'))
110+
end
111+
end)
112+
end
113+
114+
if data.current.value == 'no' then
115+
local player = PlayerPedId()
116+
TriggerEvent('esx_skin:getLastSkin', function(skin)
117+
TriggerEvent('skinchanger:loadSkin', skin)
118+
end)
119+
if accessory == "Ears" then
120+
ClearPedProp(player, 2)
121+
elseif accessory == "Mask" then
122+
SetPedComponentVariation(player, 1, 0 ,0, 2)
123+
elseif accessory == "Helmet" then
124+
ClearPedProp(player, 0)
125+
elseif accessory == "Glasses" then
126+
SetPedPropIndex(player, 1, -1, 0, 0)
127+
end
128+
end
129+
CurrentAction = 'shop_menu'
130+
CurrentActionMsg = _U('press_access')
131+
CurrentActionData = {}
132+
end, function(data, menu)
133+
menu.close()
134+
CurrentAction = 'shop_menu'
135+
CurrentActionMsg = _U('press_access')
136+
CurrentActionData = {}
137+
138+
end)
139+
end, function(data, menu)
140+
menu.close()
141+
CurrentAction = 'shop_menu'
142+
CurrentActionMsg = _U('press_access')
143+
CurrentActionData = {}
144+
end, restrict)
145+
end
146+
147+
AddEventHandler('playerSpawned', function()
148+
isDead = false
149+
end)
150+
151+
AddEventHandler('esx:onPlayerDeath', function()
152+
isDead = true
153+
end)
154+
155+
AddEventHandler('esx_accessories:hasEnteredMarker', function(zone)
156+
CurrentAction = 'shop_menu'
157+
CurrentActionMsg = _U('press_access')
158+
CurrentActionData = { accessory = zone }
159+
end)
160+
161+
AddEventHandler('esx_accessories:hasExitedMarker', function(zone)
162+
ESX.UI.Menu.CloseAll()
163+
CurrentAction = nil
164+
end)
165+
166+
-- Create Blips --
167+
Citizen.CreateThread(function()
168+
for k,v in pairs(Config.ShopsBlips) do
169+
if v.Pos ~= nil then
170+
for i=1, #v.Pos, 1 do
171+
local blip = AddBlipForCoord(v.Pos[i].x, v.Pos[i].y, v.Pos[i].z)
172+
173+
SetBlipSprite (blip, v.Blip.sprite)
174+
SetBlipDisplay(blip, 4)
175+
SetBlipScale (blip, 1.0)
176+
SetBlipColour (blip, v.Blip.color)
177+
SetBlipAsShortRange(blip, true)
178+
179+
BeginTextCommandSetBlipName("STRING")
180+
AddTextComponentString(_U('shop', _U(string.lower(k))))
181+
EndTextCommandSetBlipName(blip)
182+
end
183+
end
184+
end
185+
end)
186+
187+
-- Display markers
188+
Citizen.CreateThread(function()
189+
while true do
190+
Citizen.Wait(0)
191+
local coords = GetEntityCoords(PlayerPedId())
192+
for k,v in pairs(Config.Zones) do
193+
for i = 1, #v.Pos, 1 do
194+
if(Config.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos[i].x, v.Pos[i].y, v.Pos[i].z, true) < Config.DrawDistance) then
195+
DrawMarker(Config.Type, v.Pos[i].x, v.Pos[i].y, v.Pos[i].z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.Size.x, Config.Size.y, Config.Size.z, Config.Color.r, Config.Color.g, Config.Color.b, 100, false, true, 2, false, false, false, false)
196+
end
197+
end
198+
end
199+
end
200+
end)
201+
202+
203+
Citizen.CreateThread(function()
204+
while true do
205+
Citizen.Wait(200)
206+
207+
local coords = GetEntityCoords(PlayerPedId())
208+
local isInMarker = false
209+
local currentZone = nil
210+
for k,v in pairs(Config.Zones) do
211+
for i = 1, #v.Pos, 1 do
212+
if GetDistanceBetweenCoords(coords, v.Pos[i].x, v.Pos[i].y, v.Pos[i].z, true) < Config.Size.x then
213+
isInMarker = true
214+
currentZone = k
215+
end
216+
end
217+
end
218+
219+
if (isInMarker and not HasAlreadyEnteredMarker) or (isInMarker and LastZone ~= currentZone) then
220+
HasAlreadyEnteredMarker = true
221+
LastZone = currentZone
222+
TriggerEvent('esx_accessories:hasEnteredMarker', currentZone)
223+
end
224+
225+
if not isInMarker and HasAlreadyEnteredMarker then
226+
HasAlreadyEnteredMarker = false
227+
TriggerEvent('esx_accessories:hasExitedMarker', LastZone)
228+
end
229+
230+
end
231+
end)
232+
233+
-- Key controls
234+
Citizen.CreateThread(function()
235+
while true do
236+
Citizen.Wait(0)
237+
238+
if CurrentAction ~= nil then
239+
ESX.ShowHelpNotification(CurrentActionMsg)
240+
241+
if IsControlJustReleased(0, Keys['E']) and CurrentActionData.accessory then
242+
OpenShopMenu(CurrentActionData.accessory)
243+
CurrentAction = nil
244+
end
245+
elseif CurrentAction == nil and not Config.EnableControls then
246+
Citizen.Wait(500)
247+
end
248+
249+
if Config.EnableControls then
250+
if IsControlJustReleased(0, Keys['K']) and GetLastInputMethod(2) and not isDead then
251+
OpenAccessoryMenu()
252+
end
253+
end
254+
255+
end
256+
end)

0 commit comments

Comments
 (0)