#undef DEBUG
using System;
using System.Collections.Generic;
using System.Net;
using System.Runtime.InteropServices;
using System.Threading;
using GTA;
using Lidgren.Network;
using Newtonsoft.Json;
using RageCoop.Client.Menus;
using RageCoop.Core;
using RageCoop.Core.Scripting;
namespace RageCoop.Client.Scripting
{
///
///
public class CustomEventReceivedArgs : EventArgs
{
///
/// The event hash
///
public int Hash { get; set; }
///
/// Supported types: byte, short, ushort, int, uint, long, ulong, float, bool, string, Vector3, Quaternion
///
public object[] Args { get; set; }
}
///
/// Provides vital functionality to interact with RAGECOOP
///
public static unsafe partial class API
{
#region INTERNAL
internal static Dictionary>> CustomEventHandlers =
new Dictionary>>();
#endregion
///
/// Client configuration, this will conflict with server-side config.
///
public static class Config
{
///
/// Get or set local player's username, set won't be effective if already connected to a server.
///
public static string Username
{
get => Main.Settings.Username;
set
{
if (Networking.IsOnServer || string.IsNullOrEmpty(value)) return;
Main.Settings.Username = value;
}
}
///
/// Enable automatic respawn for this player.
///
public static bool EnableAutoRespawn { get; set; } = true;
///
/// Get or set player's blip color
///
public static BlipColor BlipColor { get; set; } = BlipColor.White;
///
/// Get or set player's blip sprite
///
public static BlipSprite BlipSprite { get; set; } = BlipSprite.Standard;
///
/// Get or set scale of player's blip
///
public static float BlipScale { get; set; } = 1;
}
///
/// Base events for RageCoop
///
public static class Events
{
///
/// The local player is dead
///
public static event EmptyEvent OnPlayerDied;
///
/// A local vehicle is spawned
///
public static event EventHandler OnVehicleSpawned;
///
/// A local vehicle is deleted
///
public static event EventHandler OnVehicleDeleted;
///
/// A local ped is spawned
///
public static event EventHandler OnPedSpawned;
///
/// A local ped is deleted
///
public static event EventHandler OnPedDeleted;
#region DELEGATES
///
///
public delegate void EmptyEvent();
///
///
///
///
public delegate void CustomEvent(int hash, List