Skip to content

Instantly share code, notes, and snippets.

@HardstylesDev
Created December 31, 2021 13:12
Show Gist options
  • Save HardstylesDev/0fa51e2a16f6f352fd36c1c8a25a4ade to your computer and use it in GitHub Desktop.
Save HardstylesDev/0fa51e2a16f6f352fd36c1c8a25a4ade to your computer and use it in GitHub Desktop.
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