Skip to content

Commit

Permalink
Change welcome message method from Chat > Notification. Also adds eas…
Browse files Browse the repository at this point in the history
…y way to disable the welcome message.
  • Loading branch information
davwheat committed Oct 24, 2018
1 parent 7499c1d commit d906f42
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 27 deletions.
Binary file modified _Resource/VoiceGPS.zip
Binary file not shown.
Binary file modified _Resource/VoiceGPS/VoiceGPS_FiveM.Client.net.dll
Binary file not shown.
Binary file modified _Resource/VoiceGPS/VoiceGPS_FiveM.Server.net.dll
Binary file not shown.
37 changes: 14 additions & 23 deletions src/VoiceGPS-FiveM.Client/ClientScript.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Reflection;
using CitizenFX.Core;
using CitizenFX.Core.Native;
using System.Threading.Tasks;
Expand All @@ -10,9 +11,10 @@ public class ClientScript : BaseScript
{
private static Ped _playerPed;

// Default volume (between 0.1 and 1.0)
private double _audioVolume = 0.7;

private bool _justPlayed1000M, _justPlayed200M, _justPlayedFollowRoad, _justPlayedImmediate, _playedStartDriveAudio, _justPlayedRecalc, _voiceGpsEnabled;
private bool _justPlayed1000M, _justPlayed200M, _justPlayedFollowRoad, _justPlayedImmediate, _playedStartDriveAudio, _justPlayedRecalc, _voiceGpsEnabled, _welcomeShowed;
private bool _justPlayedArrived = true;

private int _lastDirection;
Expand All @@ -21,35 +23,24 @@ public ClientScript()
{
Chat("VGPS Loaded");
EventHandlers.Add("vgps:toggleVGPS", new Action(ToggleVgps));
//EventHandlers.Add("vgps:adjustVolume", new Action<List<object>>(ChangeVolume));

Tick += OnTick;
// UNCOMMENT BELOW LINE TO REMOVE THE WELCOME MESSAGE
//_welcomeShowed = true;

Chat("^2This server uses VoiceGPS!");
Chat("^2Created by ^1github.com/davwheat");
Chat("^2Toggle VoiceGPS on and off using ^1/vgps");
Tick += OnTick;

_playerPed = GetPlayerPed();
}

//void ChangeVolume(List<object> args)
//{
// if (!double.TryParse(args[0].ToString(), out var volume)) {
// ShowNotification("~r~VoiceGPS volume must be a valid number between 1.0 and 0.0!");
// return;
// }

// if (volume > 1.0D || volume < 0.0D)
// {
// ShowNotification("~r~VoiceGPS volume must be a valid number between 1.0 and 0.0!");
// return;
// }

// _audioVolume = volume;
//}

private async Task OnTick()
{
if (!_welcomeShowed)
{
ShowNotification("~b~VoiceGPS~w~ | ~o~by github.com/davwheat");
ShowNotification("~b~To enable GPS speech, type ~o~/vgps");
_welcomeShowed = true;
}

if (Game.IsControlJustReleased(1, Control.DropAmmo))
{
ToggleVgps();
Expand Down Expand Up @@ -313,4 +304,4 @@ private void PlayAudio(string filename)
API.SendNuiMessage(json);
}
}
}
}
4 changes: 2 additions & 2 deletions src/VoiceGPS-FiveM.Client/VoiceGPS-FiveM.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Resource\VoiceGPS\</OutputPath>
<OutputPath>..\..\_Resource\VoiceGPS\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand Down Expand Up @@ -51,6 +51,6 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>del /f "..\..\resource\voicegps\VoiceGPS_FiveM.Client.net.pdb"</PostBuildEvent>
<PostBuildEvent>del /f "..\..\_resource\voicegps\VoiceGPS_FiveM.Client.net.pdb"</PostBuildEvent>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions src/VoiceGPS-FiveM.Server/VoiceGPS-FiveM.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Resource\VoiceGPS\</OutputPath>
<OutputPath>..\..\_Resource\VoiceGPS\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand Down Expand Up @@ -70,6 +70,6 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>del /f "..\..\resource\voicegps\VoiceGPS_FiveM.Server.net.pdb"</PostBuildEvent>
<PostBuildEvent>del /f "..\..\_resource\voicegps\VoiceGPS_FiveM.Server.net.pdb"</PostBuildEvent>
</PropertyGroup>
</Project>

0 comments on commit d906f42

Please sign in to comment.