Created
December 31, 2021 13:12
-
-
Save HardstylesDev/0fa51e2a16f6f352fd36c1c8a25a4ade to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using CitizenFX.Core; | |
using static CitizenFX.Core.Native.API; | |
namespace MyResourceNameServer.commands | |
{ | |
public class WashCommand : BaseScript | |
{ | |
public WashCommand() | |
{ | |
EventHandlers["onClientResourceStart"] += new Action<string>(OnClientResourceStart); | |
} | |
private static void OnClientResourceStart(string resourceName) | |
{ | |
if (GetCurrentResourceName() != resourceName) return; | |
RegisterCommand("wash", new Action<int, List<object>, string>((source, args, raw) => | |
{ | |
var veh = Game.PlayerPed.CurrentVehicle; | |
if (veh == null) | |
{ | |
ShowNotification("~r~Je moet in een auto zitten om dit te gebruiken!"); | |
return; | |
} | |
WashDecalsFromVehicle(veh.Handle, 1); | |
SetVehicleDirtLevel(veh.Handle, 0f); | |
ShowNotification("~g~Je auto is gewassen!"); | |
}), false); | |
} | |
private static void ShowNotification(string text) | |
{ | |
SetNotificationTextEntry("STRING"); | |
AddTextComponentString(text); | |
DrawNotification(false, false); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment