Skip to content
This repository has been archived by the owner on May 13, 2021. It is now read-only.

Commit

Permalink
Added support for venomous freemode
Browse files Browse the repository at this point in the history
  • Loading branch information
ghermans committed Oct 21, 2018
1 parent ac7f350 commit a9251ae
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 25 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.3
- Added support for [venomous-freemode](https://github.com/FiveM-Scripts/venomous-freemode)

## 1.2
- Fixed the conflict where players would always spawn at the LSIA entrance when using any plane in the airport zone.
- Fixed the conflict where players could not get killed by pedestrians or other players after leaving the plane.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# FiveM Airports
[![GitHub release](https://img.shields.io/github/release/Fivem-Scripts/airports.svg)](https://github.com/FiveM-Scripts/airports/releases/latest)
[![GitHub license](https://img.shields.io/github/license/FiveM-Scripts/airports.svg)](https://github.com/FiveM-Scripts/airports/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/Fivem-Scripts/airports.svg)](https://github.com/FiveM-Scripts/airports/releases/latest) [![GitHub license](https://img.shields.io/github/license/FiveM-Scripts/airports.svg)](https://github.com/FiveM-Scripts/airports/blob/master/LICENSE)
<a href="https://discord.gg/qnAqCEd" title="Chat on Discord"><img alt="Discord Status" src="https://discordapp.com/api/guilds/285462938691567627/widget.png"></a>

With this resource players can fly from **Los Santos International Airport** to **Sandy Shores Airfield** and back.

## Requirements
- [NativeUILua](https://github.com/FrazzIe/NativeUILua)
- [Essentialmode](https://forum.fivem.net/t/release-essentialmode-base/3665) (optional)
- [venomous-freemode](https://github.com/FiveM-Scripts/venomous-freemode) (optional)

## Installation
1. Download the latest [release](https://github.com/FiveM-Scripts/airports/releases)
Expand All @@ -16,4 +16,4 @@ With this resource players can fly from **Los Santos International Airport** to
4. (re)start your server.

## Changelog
You can find the changelog [here](https://github.com/FiveM-Scripts/airports/blob/master/CHANGELOG.md).
You can find the changelog [here](https://github.com/FiveM-Scripts/airports/blob/master/CHANGELOG.md).
2 changes: 1 addition & 1 deletion __resource.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource_manifest_version '05cfa83c-a124-4cfa-a768-c24a5811d8f9'
resource_version '1.1'
resource_version '1.2'

dependency 'NativeUI'

Expand Down
5 changes: 2 additions & 3 deletions client/airports.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ local function CreateAirportBlips()
SetBlipSprite(blip, 90)
SetBlipAsShortRange(blip, true)

BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Airport")
BeginTextCommandSetBlipName("BLIP_90")
EndTextCommandSetBlipName(blip)
end
end
Expand All @@ -45,7 +44,7 @@ function IsPlayerNearAirport()
if not _menuPool:IsAnyMenuOpen() then
if not IsHelpMessageBeingDisplayed() then
BeginTextCommandDisplayHelp("STRING")
AddTextComponentSubstringPlayerName("Press ~INPUT_CONTEXT~ to travel.")
AddTextComponentSubstringPlayerName(GetLabelText("MATC_DPADRIGHT"))
EndTextCommandDisplayHelp(0, 0, 1, -1)
end
else
Expand Down
6 changes: 3 additions & 3 deletions client/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ Citizen.CreateThread(function()
end
end
else
if _menuPool:IsAnyMenuOpen() then
mainMenu:Visible(not mainMenu:Visible())
end
if _menuPool:IsAnyMenuOpen() then
mainMenu:Visible(not mainMenu:Visible())
end
end

if not landing then
Expand Down
4 changes: 2 additions & 2 deletions client/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function ShowNotification(text)
end

function AddAirPortMenu(menu)
if config.use_essentialmode then
if config.use_essentialmode or config.use_venomous then
SantonsButton = NativeUI.CreateItem("Los Santos International Airport", "Buy a ticket for "..config.moneyCurrency .." " ..config.ticketPrice)
DesrtButton = NativeUI.CreateItem("Sandy Shores Airfield", "Buy a ticket for "..config.moneyCurrency .." " ..config.ticketPrice)
else
Expand All @@ -43,7 +43,7 @@ function AddAirPortMenu(menu)
if not IsEntityInZone(PlayerPedId(), "DESRT") then
startZone = "AIRP"
planeDest = "DESRT"
if config.use_essentialmode then
if config.use_essentialmode or config.use_venomous then
TriggerServerEvent('airports:payTicket', -1675.2446, -2798.8835, 14.5409, 327.8560, planeDest, config.ticketPrice)
else
CreatePlane(-1675.2446, -2798.8835, 14.5409, 327.8560, planeDest)
Expand Down
1 change: 1 addition & 0 deletions client/spawn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ end

RegisterNetEvent("airports:departure")
AddEventHandler("airports:departure", function(x, y, z, heading, planeDest)
ClearAllHelpMessages()
CreatePlane(x, y, z, heading, planeDest)
end)

Expand Down
5 changes: 3 additions & 2 deletions config.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
config = {
plane_model = "nimbus",
use_essentialmode = false,
use_venomous = true,
moneyCurrency = "$",
ticketPrice = 80,
}
ticketPrice = 80
}
35 changes: 24 additions & 11 deletions server/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,28 @@ end

RegisterServerEvent("airports:payTicket")
AddEventHandler("airports:payTicket", function(x, y, z, heading, destination, price)
TriggerEvent("es:getPlayerFromId", tonumber(source), function(user)
if user.getMoney() >= tonumber(price) then
user.removeMoney(tonumber(price))
TriggerClientEvent("airports:departure", tonumber(source), x, y, z, heading, destination)
elseif user.getBank() >= tonumber(price) then
user.removeBank(tonumber(price))
TriggerClientEvent("airports:departure", tonumber(source), x, y, z, heading, destination)
else
TriggerClientEvent("airports:moneyInvalid", tonumber(source))
end
end)
if config.use_essentialmode then
TriggerEvent("es:getPlayerFromId", tonumber(source), function(user)
RconPrint('using Essentialmode')

if user.getMoney() >= tonumber(price) then
user.removeMoney(tonumber(price))
TriggerClientEvent("airports:departure", tonumber(source), x, y, z, heading, destination)
elseif user.getBank() >= tonumber(price) then
user.removeBank(tonumber(price))
TriggerClientEvent("airports:departure", tonumber(source), x, y, z, heading, destination)
else
TriggerClientEvent("airports:moneyInvalid", tonumber(source))
end
end)
elseif config.use_venomous then
TriggerEvent('vf_base:FindPlayer', source, function(user)
if user.cash >= tonumber(price) then
TriggerEvent('vf_base:ClearCash', source, tonumber(price))
TriggerClientEvent("airports:departure", tonumber(source), x, y, z, heading, destination)
else
TriggerClientEvent("airports:moneyInvalid", tonumber(source))
end
end)
end
end)

0 comments on commit a9251ae

Please sign in to comment.