Add files via upload
This commit is contained in:
parent
7b9491b428
commit
77835332d7
|
@ -0,0 +1,165 @@
|
|||
ESX = nil
|
||||
local IsAlreadyDrunk = false
|
||||
local DrunkLevel = -1
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while ESX == nil do
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
end)
|
||||
|
||||
function Drunk(level, start)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
|
||||
local playerPed = GetPlayerPed(-1)
|
||||
|
||||
if start then
|
||||
DoScreenFadeOut(800)
|
||||
Wait(1000)
|
||||
end
|
||||
|
||||
if level == 0 then
|
||||
|
||||
RequestAnimSet("move_m@drunk@slightlydrunk")
|
||||
|
||||
while not HasAnimSetLoaded("move_m@drunk@slightlydrunk") do
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
|
||||
SetPedMovementClipset(playerPed, "move_m@drunk@slightlydrunk", true)
|
||||
|
||||
elseif level == 1 then
|
||||
|
||||
RequestAnimSet("move_m@drunk@moderatedrunk")
|
||||
|
||||
while not HasAnimSetLoaded("move_m@drunk@moderatedrunk") do
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
|
||||
SetPedMovementClipset(playerPed, "move_m@drunk@moderatedrunk", true)
|
||||
|
||||
elseif level == 2 then
|
||||
|
||||
RequestAnimSet("move_m@drunk@verydrunk")
|
||||
|
||||
while not HasAnimSetLoaded("move_m@drunk@verydrunk") do
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
|
||||
SetPedMovementClipset(playerPed, "move_m@drunk@verydrunk", true)
|
||||
|
||||
end
|
||||
|
||||
SetTimecycleModifier("spectator5")
|
||||
SetPedMotionBlur(playerPed, true)
|
||||
SetPedIsDrunk(playerPed, true)
|
||||
|
||||
if start then
|
||||
DoScreenFadeIn(800)
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
function Reality()
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
|
||||
local playerPed = GetPlayerPed(-1)
|
||||
|
||||
DoScreenFadeOut(800)
|
||||
Wait(1000)
|
||||
|
||||
ClearTimecycleModifier()
|
||||
ResetScenarioTypesEnabled()
|
||||
ResetPedMovementClipset(playerPed, 0)
|
||||
SetPedIsDrunk(playerPed, false)
|
||||
SetPedMotionBlur(playerPed, false)
|
||||
|
||||
DoScreenFadeIn(800)
|
||||
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
AddEventHandler('esx_status:loaded', function(status)
|
||||
|
||||
TriggerEvent('esx_status:registerStatus', 'drunk', 0, '#8F15A5',
|
||||
function(status)
|
||||
if status.val > 0 then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end,
|
||||
function(status)
|
||||
status.remove(1500)
|
||||
end
|
||||
)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
|
||||
while true do
|
||||
|
||||
Wait(1000)
|
||||
|
||||
TriggerEvent('esx_status:getStatus', 'drunk', function(status)
|
||||
|
||||
if status.val > 0 then
|
||||
|
||||
local start = true
|
||||
|
||||
if IsAlreadyDrunk then
|
||||
start = false
|
||||
end
|
||||
|
||||
local level = 0
|
||||
|
||||
if status.val <= 250000 then
|
||||
level = 0
|
||||
elseif status.val <= 500000 then
|
||||
level = 1
|
||||
else
|
||||
level = 2
|
||||
end
|
||||
|
||||
if level ~= DrunkLevel then
|
||||
Drunk(level, start)
|
||||
end
|
||||
|
||||
IsAlreadyDrunk = true
|
||||
DrunkLevel = level
|
||||
end
|
||||
|
||||
if status.val == 0 then
|
||||
|
||||
if IsAlreadyDrunk then
|
||||
Reality()
|
||||
end
|
||||
|
||||
IsAlreadyDrunk = false
|
||||
DrunkLevel = -1
|
||||
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx_optionalneeds:onDrink')
|
||||
AddEventHandler('esx_optionalneeds:onDrink', function()
|
||||
|
||||
local playerPed = GetPlayerPed(-1)
|
||||
|
||||
TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_DRINKING", 0, 1)
|
||||
Citizen.Wait(1000)
|
||||
ClearPedTasksImmediately(playerPed)
|
||||
|
||||
end)
|
|
@ -0,0 +1,5 @@
|
|||
Config = {}
|
||||
|
||||
Config.TickTime = 100
|
||||
Config.UpdateClientTime = 5000
|
||||
Config.Locale = 'de'
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
|
||||
INSERT INTO `items` (`name`, `label`, `weight`) VALUES
|
||||
('beer', 'Bier', 1)
|
||||
;
|
||||
|
||||
INSERT INTO `shops` (store, item, price) VALUES
|
||||
('TwentyFourSeven', 'beer', 45),
|
||||
('RobsLiquor', 'beer', 45),
|
||||
('LTDgasoline', 'beer', 45)
|
||||
;
|
|
@ -0,0 +1,22 @@
|
|||
fx_version 'adamant'
|
||||
|
||||
game 'gta5'
|
||||
|
||||
description 'ESX Optional Needs '
|
||||
|
||||
version '1.0.3'
|
||||
|
||||
server_scripts {
|
||||
'@es_extended/locale.lua',
|
||||
'locales/en.lua',
|
||||
'locales/de.lua',
|
||||
'locales/fi.lua',
|
||||
'locales/fr.lua',
|
||||
'locales/pl.lua',
|
||||
'config.lua',
|
||||
'server/main.lua'
|
||||
}
|
||||
|
||||
client_scripts {
|
||||
'client/main.lua'
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
Locales['de'] = {
|
||||
|
||||
['used_beer'] = 'du hast ~y~1x~s~ ~b~Bier getrunken~s~',
|
||||
['used_tequila'] = 'du hast ~y~1x~s~ ~b~Tequila getrunken~s~',
|
||||
['used_vanil_smot'] = 'du hast ~y~1x~s~ ~b~Vanilleshake getrunken~s~',
|
||||
['used_vine'] = 'du hast ~y~1x~s~ ~b~Vine getrunken~s~',
|
||||
['used_vodka'] = 'du hast ~y~1x~s~ ~b~Wodka getrunken~s~',
|
||||
['used_vodkaenergy'] = 'du hast ~y~1x~s~ ~b~Wodka Energy getrunken~s~',
|
||||
['used_vodkafruit'] = 'du hast ~y~1x~s~ ~b~Wodkafruit getrunken~s~',
|
||||
['used_wine'] = 'du hast ~y~1x~s~ ~b~Wein getrunken~s~',
|
||||
['used_whiskycoca'] = 'du hast ~y~1x~s~ ~b~Whisky Cola getrunken~s~',
|
||||
['used_whisky'] = 'du hast ~y~1x~s~ ~b~Whisky getrunken~s~',
|
||||
['used_jager'] = 'du hast ~y~1x~s~ ~b~Jägermeister getrunken~s~',
|
||||
['used_martini'] = 'du hast ~y~1x~s~ ~b~Martini getrunken~s~',
|
||||
['used_rhum'] = 'du hast ~y~1x~s~ ~b~Rum getrunken~s~',
|
||||
['used_cubalibre'] = 'du hast ~y~1x~s~ ~b~Cuba Libre getrunken~s~',
|
||||
['used_golem'] = 'du hast ~y~1x~s~ ~b~Golem getrunken~s~',
|
||||
['used_bacardi'] = 'du hast ~y~1x~s~ ~b~Bacardi getrunken~s~',
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
Locales['en'] = {
|
||||
|
||||
['used_beer'] = 'you used 1x ~y~Beer~s~',
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
Locales['fi'] = {
|
||||
|
||||
['used_beer'] = 'sinä joit 1x ~y~Olut~s~',
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
Locales['fr'] = {
|
||||
|
||||
['used_beer'] = 'vous avez utilisé 1x ~y~Bière~s~',
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
Locales['pl'] = {
|
||||
|
||||
['used_beer'] = 'używasz 1x ~y~Piwo~s~',
|
||||
|
||||
}
|
|
@ -0,0 +1,181 @@
|
|||
ESX = nil
|
||||
|
||||
TriggerEvent('esx:getSharedObject', function(obj)
|
||||
ESX = obj
|
||||
end)
|
||||
|
||||
ESX.RegisterUsableItem('beer', function(source)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeInventoryItem('beer', 1)
|
||||
|
||||
TriggerClientEvent('esx_status:add', source, 'drunk', 250000)
|
||||
TriggerClientEvent('esx_optionalneeds:onDrink', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('used_beer'))
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterUsableItem('whisky', function(source)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeInventoryItem('whisky', 1)
|
||||
|
||||
TriggerClientEvent('esx_status:add', source, 'drunk', 2300000)
|
||||
TriggerClientEvent('esx_optionalneeds:onDrink', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('used_whisky'))
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterUsableItem('whiskycoca', function(source)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeInventoryItem('whiskycoca', 1)
|
||||
|
||||
TriggerClientEvent('esx_status:add', source, 'drunk', 2300000)
|
||||
TriggerClientEvent('esx_optionalneeds:onDrink', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('used_whiskycoca'))
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterUsableItem('wine', function(source)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeInventoryItem('wine', 1)
|
||||
|
||||
TriggerClientEvent('esx_status:add', source, 'drunk', 260000)
|
||||
TriggerClientEvent('esx_optionalneeds:onDrink', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('used_wine'))
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterUsableItem('vine', function(source)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeInventoryItem('vine', 1)
|
||||
|
||||
TriggerClientEvent('esx_status:add', source, 'drunk', 260000)
|
||||
TriggerClientEvent('esx_optionalneeds:onDrink', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('used_vine'))
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterUsableItem('vodkafruit', function(source)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeInventoryItem('vodkafruit', 1)
|
||||
|
||||
TriggerClientEvent('esx_status:add', source, 'drunk', 2300000)
|
||||
TriggerClientEvent('esx_optionalneeds:onDrink', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('used_vodkafruit'))
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterUsableItem('vodkaenergy', function(source)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeInventoryItem('vodkaenergy', 1)
|
||||
|
||||
TriggerClientEvent('esx_status:add', source, 'drunk', 2300000)
|
||||
TriggerClientEvent('esx_optionalneeds:onDrink', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('used_vodkaenergy'))
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterUsableItem('vodka', function(source)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeInventoryItem('vodka', 1)
|
||||
|
||||
TriggerClientEvent('esx_status:add', source, 'drunk', 2300000)
|
||||
TriggerClientEvent('esx_optionalneeds:onDrink', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('used_vodka'))
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterUsableItem('tequila', function(source)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeInventoryItem('tequila', 1)
|
||||
|
||||
TriggerClientEvent('esx_status:add', source, 'drunk', 2300000)
|
||||
TriggerClientEvent('esx_optionalneeds:onDrink', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('used_tequila'))
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterUsableItem('rhum', function(source)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeInventoryItem('rhum', 1)
|
||||
|
||||
TriggerClientEvent('esx_status:add', source, 'drunk', 2300000)
|
||||
TriggerClientEvent('esx_optionalneeds:onDrink', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('used_rhum'))
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterUsableItem('martini', function(source)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeInventoryItem('martini', 1)
|
||||
|
||||
TriggerClientEvent('esx_status:add', source, 'drunk', 2300000)
|
||||
TriggerClientEvent('esx_optionalneeds:onDrink', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('used_martini'))
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterUsableItem('jager', function(source)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeInventoryItem('jager', 1)
|
||||
|
||||
TriggerClientEvent('esx_status:add', source, 'drunk', 1800000)
|
||||
TriggerClientEvent('esx_optionalneeds:onDrink', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('used_jager'))
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterUsableItem('cubalibre', function(source)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeInventoryItem('cubalibre', 1)
|
||||
|
||||
TriggerClientEvent('esx_status:add', source, 'drunk', 12000000)
|
||||
TriggerClientEvent('esx_optionalneeds:onDrink', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('used_cubalibre'))
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterUsableItem('bacardi', function(source)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeInventoryItem('bacardi', 1)
|
||||
|
||||
TriggerClientEvent('esx_status:add', source, 'drunk', 2300000)
|
||||
TriggerClientEvent('esx_optionalneeds:onDrink', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('used_bacardi'))
|
||||
|
||||
end)
|
||||
|
||||
|
||||
print("^0======================================================================^7")
|
||||
print("^0[^4Author^0] ^7:^0 ^0M_Viper^7")
|
||||
print("^0[^3Version^0] ^7:^0 1.0.3^7")
|
||||
print("^0[^2Discord^0] ^7:^0 ^5dc.Difficult-Knights.de")
|
||||
print("^0[^1YouTube^0] ^7:^0 ^5https://www.youtube.com/channel/UCmTXYM0rY7VlVlNrOA-O63A^7")
|
||||
print("^0======================================================================^7")
|
Loading…
Reference in New Issue