Untitled
unknown
csharp
4 years ago
1.4 kB
5
Indexable
public class Propset { public string Name { get; private set; } public uint Hash { get; private set; } public bool IsLoaded { get; private set; } public Propset(string name) { Name = name; Hash = (uint)API.GetHashKey(name); } public async Task Load() { if (IsLoaded) return; Function.Call((Hash)0xF3DE57A46D5585E9, Hash); var time = World.Time; while (!Function.Call<bool>((Hash)0x48A88FC684C55FDC, Hash)) { await BaseScript.Delay(0); if (World.Time - time > 5000) { throw new Exception("Propset could not been loaded"); } } IsLoaded = true; } public void Unload() { Function.Call((Hash)0xB1964A83B345B4AB, Hash); IsLoaded = false; } public async Task SpawnAt(params Vector3[] positions) { await Load(); Debug.WriteLine("Spawning propset " + Name); foreach (var position in positions) { Function.Call((Hash)0x899C97A1CCE7D483, Hash, position.X, position.Y, position.Z, 0, 60.0, 1200.0, false, true); } Unload(); } }
Editor is loading...