Comments (4)
It may happen if the model (modelId) was not loaded. Can you show loadModel
?
also what do you mean as "async mode"? I don't see any async/await keywords in this code.
from cleo-redux.
export const loadModel = (modelId: number) => {
Streaming.RequestModel(modelId);
while (!Streaming.HasModelLoaded(modelId)) {
wait(250);
}
}
It's ok when it's like:
while (true) {
wait(250);
if (Pad.IsKeyPressed(KeyCode.F1))
spawnCar(CAR_ID);
}
but when I use it in an async loop then the game freezes:
(async () => {
while (true) {
await asyncWait(250);
if (Pad.IsKeyPressed(KeyCode.F1))
spawnCar(CAR_ID);
}
)();
from cleo-redux.
you can't use wait
in async scripts. rewrite loadModel to be an async function and use asyncWait
export const loadModel = async (modelId: number) => {
Streaming.RequestModel(modelId);
while (!Streaming.HasModelLoaded(modelId)) {
await asyncWait(250);
}
}
async function spawnCar(modelId: number) {
log('spawnCar: loadModel ' + new Date().toTimeString());
await loadModel(modelId);
log('spawnCar: create car' + new Date().toTimeString());
// Car.Create this freeze game
this.currentCar = Car.Create(modelId, this.playerPos.x, this.playerPos.y, this.playerPos.z);
log('spawnCar: after create car' + new Date().toTimeString());
log('spawnCar: MarkModelAsNoLongerNeeded ' + new Date().toTimeString());
Streaming.MarkModelAsNoLongerNeeded(modelId);
log('spawnCar: end ' + new Date().toTimeString());
}
(async () => {
while (true) {
await asyncWait(250);
if (Pad.IsKeyPressed(KeyCode.F1))
await spawnCar(CAR_ID);
}
)();
from cleo-redux.
Sorry, I've copied the latest script where I've removed all async methods.
I've copied and pasted your code with asyncWait
and the problem still occurs:
Vice City DE and San Andreas DE works correctly 🤔
from cleo-redux.
Related Issues (20)
- CLEO commands with multiple outputs don't work correctly HOT 2
- [Bully] `Clothing.BuildPlayer()` crashes the game HOT 1
- support "long strings" in III and VC if CLEO library is present HOT 1
- GTA VC Definitive Edition CRASHES
- For Installer (UAL Filename) HOT 8
- Is it possible to restore the original music using CLEO Redux in San Andreas Definitive Edition
- [STEAM] GTA Trilogy - Error Cleo Redux is and Ultimate ASI Loader HOT 2
- [Classic: San Andreas] - Events.cleo Plugin Conflict with VehFuncs HOT 14
- Incompatible with new GTA Vice City DE patch 1.0.17.39540 HOT 2
- [RGL] 1.1.2 Crashes San Andreas Definitive Edition when loading a Save. HOT 8
- CLEO Redux doesn't work for ReVC OpenGL x64 build and Re3 OpenGL x64 build HOT 1
- Raknet HOT 1
- Heli.Create should return type Heli HOT 3
- Type "label" in opcodes input HOT 1
- stack trace is wrong in typescript files
- fxt support in VC: DE HOT 1
- conversion error in Memory.Fn.ThiscallU8 HOT 2
- Fx.DrawCorona bug HOT 4
- Text operations bug in 1.2.1 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cleo-redux.