Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions client/help.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-- Basic helper script for that helper script

class 'Helper'

function Helper:__init()
Events:Subscribe( "ModuleLoad", self, self.ModulesLoad )
Events:Subscribe( "ModulesLoad", self, self.ModulesLoad )
Events:Subscribe( "ModuleUnload", self, self.ModuleUnload )
end


function Helper:ModulesLoad()
Events:Fire( "HelpAddItem",
{
name = "Runways",
text =
"This script allows you to view the runways while in a plane.\n" ..
"Use \"/runways\" to toggle viewing the runways." ..
"\n\n" ..
"Script made by Eraknelo on the forums"
})
end

function Helper:ModuleUnload()
Events:Fire( "HelpRemoveItem",
{
name = "Runways"
})
end

tester = Helper()
9 changes: 8 additions & 1 deletion client/vfr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ function VFR:__init()

self.runways = LoadRunways()
self.inPlane = false
self.beVisible = true -- couldn't think of a better name but this is just whether or not the runways are visible

self.planes = {
[59] = true,
Expand All @@ -21,6 +22,7 @@ function VFR:__init()
Events:Subscribe("LocalPlayerEnterVehicle", self, self.LocalPlayerEnterVehicle)
Events:Subscribe("LocalPlayerExitVehicle", function() self.inPlane = false end)
Events:Subscribe("Render", self, self.Render)
Network:Subscribe("toggleVFR", self, self.ToggleVFR)
end

function VFR:LocalPlayerEnterVehicle(args)
Expand All @@ -35,7 +37,7 @@ function VFR:LocalPlayerEnterVehicle(args)
end

function VFR:Render()
if not self.inPlane or Game:GetState() ~= GUIState.Game then return end
if not self.inPlane or Game:GetState() ~= GUIState.Game or not self.beVisible then return end

-- Check all runways
for index, data in pairs(self.runways) do
Expand All @@ -54,6 +56,11 @@ function VFR:Render()
end
end

-- toggles if runways are visible or not
function VFR:ToggleVFR()
self.beVisible = not self.beVisible
end

Events:Subscribe("ModuleLoad", function()
VFR()
end)
10 changes: 10 additions & 0 deletions server/server.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- No need for a class if it's only 1 function

-- function checks for if someone says "/runways"
OnPlayerChat = function(args)
if args.text == "/runways" then
Network:Send(args.player, "toggleVFR")
end
end

Events:Subscribe("PlayerChat", OnPlayerChat)