Originally posted by matrixmods
So with my menu, basically it all runs out of VM_Notify but im having some problems with a couple of my functions as they require a few "sleeps" to run properly. For example spawning bots. I was just wondering if anyone has a simple fix for this or am i just going to have to make the bots function run differently so it will work
In my sprx i have 3 separate functions,
-SpawnBot
-ChooseTeam
-ChooseClass
Using sleep in your sprx is a honest mistake used by alot of ppl. Just like calling a thread when you could Hook the menu and have it run a lot smoother.
Here is an example of how i call my function to Spawn Bots.
void SpawnBots(int amount) {
for(int i = 0; i < 18; i++) botEntitys = SV_AddTestClient(); }
void ChooseTeam(int* botArray, float time) {
time = (int)floor(time * 1000 + 0.5);
for(int i = 0; i < 18; i++) {
if (botArray != 0) {
Cmd_MenuResponse(botArray, 3, "autoassign");
}
}
}
void ChooseClass(int* botArray, float time) {
time = (int)floor(time * 1000 + 0.5);
for(int i = 0; i < 18; i++) {
if (botArray != 0) {
Sprintf(temp, "class%i, G_irand(0, 5));
Cmd_MenuResponse(botArray, 10, temp);
}
}
}
Then Call like this in your functions:
if (scroll == 1)
SpawnBots(3);
else if (scroll == 2)
ChooseTeam(botEntitys, 5);
else if (scroll == 3)
ChooseClass(botEntitys, 5);
Hopefully this helped