Initial commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
|
||||
|
||||
Config = {
|
||||
-- Key used to take a hit of the vape (51)"E" by default.
|
||||
DragControl = 51,
|
||||
|
||||
-- Key used to reset to the resting vape position (58)"G" by default.
|
||||
RestingAnim = 58,
|
||||
|
||||
-- The amount of time in (ms) you will need to hold the button in order to commit to the action. (250) by default.
|
||||
ButtonHoldTime = 250,
|
||||
|
||||
-- Size of the vape clouds. (0.5) by default.
|
||||
SmokeSize = 0.5,
|
||||
|
||||
-- the Odds of your Mod exploding in your face. (10594) by default. lower the number to increase the chance you have to explode.
|
||||
FailureOdds = 10594, -- 10594 = 0.0001% chance
|
||||
|
||||
-- The amount of time in (ms) the player has to wait before the can hit the vape again. (4000) by default.
|
||||
VapeCoolDownTime = 4000,
|
||||
|
||||
-- The amount of time in (ms) the smoke from the vape will linger. (2800) by default.
|
||||
VapeHangTime = 2800,
|
||||
|
||||
-- Whether or not you want ace permissions to be enabled, False = Everyone Can vape,
|
||||
VapePermission = false,
|
||||
|
||||
-- Ace permissions group to allow access. **REQUIRED IF YOU HAVE PERMISSIONS ENABLED**
|
||||
PermissionsGroup = "ADD_ACE_GROUP_HERE",
|
||||
|
||||
-- If permissions are enabled you can set the denied access message here. **REQUIRED IF YOU HAVE PERMISSIONS ENABLED**
|
||||
InsufficientMessage = "^3You do not have permission to do this.",
|
||||
|
||||
-- This will Enable and disable the debug commands.
|
||||
Debug = false,
|
||||
|
||||
-- The Transparency of the help text when it starts. (0) by default. Just leave this alone...
|
||||
HelpTextStartingAlpha = 0,
|
||||
|
||||
-- Hold long in (ms) will the help message appear for. (8000) by default.
|
||||
HelpTextLength = 8000,
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
resource_manifest_version '05cfa83c-a124-4cfa-a768-c24a5811d8f9'
|
||||
|
||||
client_scripts{
|
||||
'Config.lua',
|
||||
'cl-vape.lua'
|
||||
}
|
||||
|
||||
server_scripts{
|
||||
'Config.lua',
|
||||
'sv-vape.lua'
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
|
||||
|
||||
|
||||
local IsPlayerAbleToVape = false
|
||||
local FadeIn = false
|
||||
local FadeOut = false
|
||||
|
||||
RegisterNetEvent("Vape:StartVaping")
|
||||
RegisterNetEvent("Vape:VapeAnimFix")
|
||||
RegisterNetEvent("Vape:StopVaping")
|
||||
RegisterNetEvent("Vape:Drag")
|
||||
|
||||
AddEventHandler("Vape:StartVaping", function(source)
|
||||
local ped = GetPlayerPed(-1)
|
||||
if DoesEntityExist(ped) and not IsEntityDead(ped) then
|
||||
if IsPedOnFoot(ped) then
|
||||
if IsPlayerAbleToVape == false then
|
||||
PlayerIsAbleToVape()
|
||||
TriggerEvent("Vape:HelpFadeIn", 0)
|
||||
ShowNotification("~c~You've ~b~started ~c~using your vape.")
|
||||
Wait(Config.HelpTextLength)
|
||||
TriggerEvent("Vape:HelpFadeOut", 0)
|
||||
else
|
||||
ShowNotification("~r~You are already holding your vape.")
|
||||
end
|
||||
else
|
||||
ShowNotification("~r~You can not do this in a vehicle.")
|
||||
end
|
||||
else
|
||||
ShowNotification("~r~You can not do this if you are dead.")
|
||||
end
|
||||
end)
|
||||
AddEventHandler("Vape:VapeAnimFix", function(source)
|
||||
local ped = GetPlayerPed(-1)
|
||||
local ad = "anim@heists@humane_labs@finale@keycards"
|
||||
local anim = "ped_a_enter_loop"
|
||||
while (not HasAnimDictLoaded(ad)) do
|
||||
RequestAnimDict(ad)
|
||||
Wait(1)
|
||||
end
|
||||
TaskPlayAnim(ped, ad, anim, 8.00, -8.00, -1, (2 + 16 + 32), 0.00, 0, 0, 0)
|
||||
end)
|
||||
AddEventHandler("Vape:StopVaping", function(source)
|
||||
if IsPlayerAbleToVape == true then
|
||||
PlayerIsUnableToVape()
|
||||
ShowNotification("~c~You've ~r~stopped ~c~using your vape.")
|
||||
else
|
||||
ShowNotification("~r~You're not holding your vape.")
|
||||
end
|
||||
end)
|
||||
AddEventHandler("Vape:Drag", function()
|
||||
if IsPlayerAbleToVape then
|
||||
local ped = GetPlayerPed(-1)
|
||||
local PedPos = GetEntityCoords(ped)
|
||||
local ad = "mp_player_inteat@burger"
|
||||
local anim = "mp_player_int_eat_burger"
|
||||
if (DoesEntityExist(ped) and not IsEntityDead(ped)) then
|
||||
while (not HasAnimDictLoaded(ad)) do
|
||||
RequestAnimDict(ad)
|
||||
Wait(1)
|
||||
end
|
||||
local VapeFailure = math.random(1,Config.FailureOdds)
|
||||
if VapeFailure == 1 then
|
||||
TaskPlayAnim(ped, ad, anim, 8.00, -8.00, -1, (2 + 16 + 32), 0.00, 0, 0, 0)
|
||||
PlaySoundFrontend(-1, "Beep_Red", "DLC_HEIST_HACKING_SNAKE_SOUNDS", 1)
|
||||
Wait(250)
|
||||
AddExplosion(PedPos.x, PedPos.y, PedPos.z+1.00, 34, 0.00, true, false, 1.00)
|
||||
ApplyDamageToPed(ped, 200, false)
|
||||
TriggerServerEvent("Vape:Failure", 0)
|
||||
else
|
||||
TaskPlayAnim(ped, ad, anim, 8.00, -8.00, -1, (2 + 16 + 32), 0.00, 0, 0, 0)
|
||||
PlaySoundFrontend(-1, "Beep_Red", "DLC_HEIST_HACKING_SNAKE_SOUNDS", 1)
|
||||
Wait(950)
|
||||
TriggerServerEvent("eff_smokes", PedToNet(ped))
|
||||
Wait(Config.VapeHangTime-1000)
|
||||
TriggerEvent("Vape:VapeAnimFix", 0)
|
||||
end
|
||||
end
|
||||
else
|
||||
ShowNotification("~r~You must be holding your vape to do this.")
|
||||
end
|
||||
end)
|
||||
AddEventHandler("Vape:HelpFadeIn", function()
|
||||
if FadeIn == false then
|
||||
FadeIn = true
|
||||
DisplayText = true
|
||||
while FadeIn == true do
|
||||
if Config.HelpTextStartingAlpha <= 255 then
|
||||
Config.HelpTextStartingAlpha = Config.HelpTextStartingAlpha+5
|
||||
if Config.HelpTextStartingAlpha >= 255 then
|
||||
FadeIn = false
|
||||
break
|
||||
end
|
||||
end
|
||||
Wait(1)
|
||||
end
|
||||
end
|
||||
end)
|
||||
AddEventHandler("Vape:HelpFadeOut", function()
|
||||
if FadeOut == false then
|
||||
FadeOut = true
|
||||
while FadeOut == true do
|
||||
if Config.HelpTextStartingAlpha >= 1 then
|
||||
Config.HelpTextStartingAlpha = Config.HelpTextStartingAlpha-5
|
||||
if Config.HelpTextStartingAlpha <= 0 then
|
||||
FadeOut = false
|
||||
DisplayText = false
|
||||
break
|
||||
end
|
||||
end
|
||||
Wait(1)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
p_smoke_location = {
|
||||
20279,
|
||||
}
|
||||
p_smoke_particle = "exp_grd_bzgas_smoke"
|
||||
p_smoke_particle_asset = "core"
|
||||
RegisterNetEvent("c_eff_smokes")
|
||||
AddEventHandler("c_eff_smokes", function(c_ped)
|
||||
for _,bones in pairs(p_smoke_location) do
|
||||
if DoesEntityExist(NetToPed(c_ped)) and not IsEntityDead(NetToPed(c_ped)) then
|
||||
createdSmoke = UseParticleFxAssetNextCall(p_smoke_particle_asset)
|
||||
createdPart = StartParticleFxLoopedOnEntityBone(p_smoke_particle, NetToPed(c_ped), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, GetPedBoneIndex(NetToPed(c_ped), bones), Config.SmokeSize, 0.0, 0.0, 0.0)
|
||||
Wait(Config.VapeHangTime)
|
||||
--Wait(250)
|
||||
while DoesParticleFxLoopedExist(createdSmoke) do
|
||||
StopParticleFxLooped(createdSmoke, 1)
|
||||
Wait(0)
|
||||
end
|
||||
while DoesParticleFxLoopedExist(createdPart) do
|
||||
StopParticleFxLooped(createdPart, 1)
|
||||
Wait(0)
|
||||
end
|
||||
while DoesParticleFxLoopedExist(p_smoke_particle) do
|
||||
StopParticleFxLooped(p_smoke_particle, 1)
|
||||
Wait(0)
|
||||
end
|
||||
while DoesParticleFxLoopedExist(p_smoke_particle_asset) do
|
||||
StopParticleFxLooped(p_smoke_particle_asset, 1)
|
||||
Wait(0)
|
||||
end
|
||||
Wait(Config.VapeHangTime*3)
|
||||
RemoveParticleFxFromEntity(NetToPed(c_ped))
|
||||
break
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
local ped = GetPlayerPed(-1)
|
||||
if IsPedInAnyVehicle(ped, true) then
|
||||
PlayerIsEnteringVehicle()
|
||||
end
|
||||
if IsPlayerAbleToVape then
|
||||
if IsControlPressed(0, Config.DragControl) then
|
||||
Wait(Config.ButtonHoldTime)
|
||||
if IsControlPressed(0, Config.DragControl) then
|
||||
TriggerEvent("Vape:Drag", 0)
|
||||
end
|
||||
Wait(Config.VapeCoolDownTime)
|
||||
end
|
||||
if IsControlPressed(0, Config.RestingAnim) then
|
||||
Wait(Config.ButtonHoldTime)
|
||||
if IsControlPressed(0, Config.RestingAnim) then
|
||||
TriggerEvent("Vape:VapeAnimFix", 0)
|
||||
end
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
Wait(1)
|
||||
end
|
||||
end)
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
if IsPlayerAbleToVape then
|
||||
if DisplayText then
|
||||
local ped = GetPlayerPed(-1)
|
||||
local pedPos = GetEntityCoords(ped)
|
||||
DrawText3d(pedPos.x, pedPos.y, pedPos.z+1.20, "~c~Hold ~b~\"E\"~c~ to take a hit.")
|
||||
DrawText3d(pedPos.x, pedPos.y, pedPos.z+1.08, "~c~Hold ~b~\"G\"~c~ to reset to rest postion.")
|
||||
end
|
||||
end
|
||||
Wait(1)
|
||||
end
|
||||
end)
|
||||
|
||||
function PlayerIsAbleToVape()
|
||||
IsPlayerAbleToVape = true
|
||||
local ped = GetPlayerPed(-1)
|
||||
local ad = "anim@heists@humane_labs@finale@keycards"
|
||||
local anim = "ped_a_enter_loop"
|
||||
|
||||
while (not HasAnimDictLoaded(ad)) do
|
||||
RequestAnimDict(ad)
|
||||
Wait(1)
|
||||
end
|
||||
TaskPlayAnim(ped, ad, anim, 8.00, -8.00, -1, (2 + 16 + 32), 0.00, 0, 0, 0)
|
||||
|
||||
local x,y,z = table.unpack(GetEntityCoords(ped))
|
||||
local prop_name = "ba_prop_battle_vape_01"
|
||||
VapeMod = CreateObject(GetHashKey(prop_name), x, y, z+0.2, true, true, true)
|
||||
AttachEntityToEntity(VapeMod, ped, GetPedBoneIndex(ped, 18905), 0.08, -0.00, 0.03, -150.0, 90.0, -10.0, true, true, false, true, 1, true)
|
||||
end
|
||||
function PlayerIsEnteringVehicle()
|
||||
IsPlayerAbleToVape = false
|
||||
local ped = GetPlayerPed(-1)
|
||||
local ad = "anim@heists@humane_labs@finale@keycards"
|
||||
DeleteObject(VapeMod)
|
||||
TaskPlayAnim(ped, ad, "exit", 8.00, -8.00, -1, (2 + 16 + 32), 0.00, 0, 0, 0)
|
||||
end
|
||||
function PlayerIsUnableToVape()
|
||||
IsPlayerAbleToVape = false
|
||||
local ped = GetPlayerPed(-1)
|
||||
DeleteObject(VapeMod)
|
||||
ClearPedTasksImmediately(ped)
|
||||
ClearPedSecondaryTask(ped)
|
||||
end
|
||||
function ShowNotification( text )
|
||||
SetNotificationTextEntry( "STRING" )
|
||||
AddTextComponentString( text )
|
||||
DrawNotification( false, false )
|
||||
end
|
||||
function DrawText3d(x, y, z, text)
|
||||
local onScreen,_x,_y=World3dToScreen2d(x,y,z)
|
||||
local px,py,pz=table.unpack(GetGameplayCamCoords())
|
||||
if onScreen then
|
||||
SetTextScale(0.3, 0.3)
|
||||
SetTextFont(0)
|
||||
SetTextProportional(1)
|
||||
SetTextColour(255, 255, 255, Config.HelpTextStartingAlpha)
|
||||
SetTextDropshadow(0, 0, 0, 0, 55)
|
||||
SetTextEdge(2, 0, 0, 0, 150)
|
||||
SetTextDropShadow()
|
||||
SetTextOutline()
|
||||
SetTextEntry("STRING")
|
||||
SetTextCentre(1)
|
||||
AddTextComponentString(text)
|
||||
DrawText(_x,_y)
|
||||
end
|
||||
end
|
||||
|
||||
if Config.Debug then
|
||||
RegisterCommand("vapesound", function(source, rawCommand)
|
||||
PlaySoundFrontend(-1, "Start_Squelch", "CB_RADIO_SFX", 1)
|
||||
ShowNotification("Play sound???")
|
||||
end)
|
||||
RegisterCommand("vapexp", function(source, rawCommand)
|
||||
local ped = GetPlayerPed(-1)
|
||||
local PedPos = GetEntityCoords(ped)
|
||||
AddExplosion(PedPos.x, PedPos.y, PedPos.z+1.00, 34, 0.00, true, false, 1.00)
|
||||
ShowNotification("Play explosion???")
|
||||
end)
|
||||
end
|
||||
@@ -0,0 +1,54 @@
|
||||
|
||||
|
||||
|
||||
RegisterNetEvent("Vape:Failure")
|
||||
RegisterServerEvent("eff_smokes")
|
||||
|
||||
if Config.VapePermission == true then
|
||||
RegisterCommand("vape", function(source, args, rawCommand)
|
||||
if IsPlayerAceAllowed(source, Config.PermissionsGroup) then
|
||||
if (tostring(args[1]) == "start") then
|
||||
TriggerClientEvent("Vape:StartVaping", source, 0)
|
||||
elseif (tostring(args[1]) == "stop") then
|
||||
TriggerClientEvent("Vape:StopVaping", source, 0)
|
||||
elseif (tostring(args[1])) ~= nil then
|
||||
TriggerClientEvent("chatMessage", source, "^1 Vaping: Error, Wrong Command must use /vape <start/stop>")
|
||||
end
|
||||
if Config.Debug then
|
||||
if (tostring(args[1]) == "fix") then
|
||||
TriggerClientEvent("Vape:VapeAnimFix", source, 0)
|
||||
elseif (tostring(args[1]) == "drag") then
|
||||
TriggerClientEvent("Vape:Drag", source, 0)
|
||||
end
|
||||
end
|
||||
else
|
||||
TriggerClientEvent("chatMessage", source, Config.InsufficientMessage)
|
||||
end
|
||||
end)
|
||||
else
|
||||
RegisterCommand("vape", function(source, args, rawCommand)
|
||||
if (tostring(args[1]) == "start") then
|
||||
TriggerClientEvent("Vape:StartVaping", source, 0)
|
||||
elseif (tostring(args[1]) == "stop") then
|
||||
TriggerClientEvent("Vape:StopVaping", source, 0)
|
||||
elseif (tostring(args[1])) ~= nil then
|
||||
TriggerClientEvent("chatMessage", source, "^1 Vaping: Error, Wrong Command must use /vape <start/stop>")
|
||||
end
|
||||
if Config.Debug then
|
||||
if (tostring(args[1]) == "fix") then
|
||||
TriggerClientEvent("Vape:VapeAnimFix", source, 0)
|
||||
elseif (tostring(args[1]) == "drag") then
|
||||
TriggerClientEvent("Vape:Drag", source, 0)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
AddEventHandler("Vape:Failure", function()
|
||||
_s = source
|
||||
Player = GetPlayerName(_s)
|
||||
TriggerClientEvent("chatMessage", -1, " ^3>>> ^2Well, it seems that ^4@"..Player.."^2's vape has exploded in their face, The odds of that are ^31 ^2in ^310,594")
|
||||
end)
|
||||
AddEventHandler("eff_smokes", function(entity)
|
||||
TriggerClientEvent("c_eff_smokes", -1, entity)
|
||||
end)
|
||||
Reference in New Issue
Block a user