Skip to content

Commit a8ebcc0

Browse files
committed
update(entity/spawn): Change SetModel from OS Thread to NextTick
1 parent 9e2150d commit a8ebcc0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/entities/Entity.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,8 @@ void Entity::Spawn()
7171
CBaseModelEntity *ent = this->worldEntity;
7272
std::string mod = this->model;
7373

74-
std::thread th([mod, ent]()
75-
{ std::this_thread::sleep_for(std::chrono::milliseconds(1)); ent->SetModel(mod.c_str()); });
76-
77-
th.detach();
74+
g_Plugin.NextFrame([ent, mod]() -> void
75+
{ ent->SetModel(mod.c_str()); });
7876
}
7977

8078
void Entity::Destroy()

0 commit comments

Comments
 (0)