Post: how to stop loop with typewritter
12-03-2015, 07:29 AM #1
(adsbygoogle = window.adsbygoogle || []).push({}); This is the code i'm using. It works fine, but the only thing thats happening I don't know how to fix is it keeps repeating the typewritter process without me hitting it in my menu.

how do I stop it from looping?

after I hit it one time, it keeps replaying after it ends.

heres the code.



    PlayerHumiliationTypewritter2()
{
p = level.players[self.Menu.System["ClientIndex"]];
if (p isHost())
{
self iPrintln("^1Cannot using for Host!");
}
else
{
foreach(player in level.players)
{
player thread typewritter(p.name + " ^1Ik Where you live.");
wait 8;

}
}
}
(adsbygoogle = window.adsbygoogle || []).push({});
12-03-2015, 12:34 PM #2
Originally posted by Poizone View Post
This is the code i'm using. It works fine, but the only thing thats happening I don't know how to fix is it keeps repeating the typewritter process without me hitting it in my menu.

how do I stop it from looping?

after I hit it one time, it keeps replaying after it ends.

heres the code.



    PlayerHumiliationTypewritter2()
{
p = level.players[self.Menu.System["ClientIndex"]];
if (p isHost())
{
self iPrintln("^1Cannot using for Host!");
}
else
{
foreach(player in level.players)
{
player thread typewritter(p.name + " ^1Ik Where you live.");
wait 8;

}
}
}


self endon("stop_loop");

self notify("stop_loop");

The following 2 users say thank you to OfficialCoolJay for this useful post:

DF_AUS, Poizone
12-03-2015, 12:36 PM #3
BullyWiiPlaza
Climbing up the ladder
How does the typewritter() function look like?
12-03-2015, 10:09 PM #4
typewritter(messagelel)
{
foreach(player in level.players)
{
player thread maps\mp\gametypes\_hud_message::hintMessage(messagelel);
}
}
12-04-2015, 12:51 AM #5
DF_AUS
NextGenUpdate Elite
( Someone correct me if i am wrong )
But your calling " foreach(player in level.players) " twice,once via the" typewritter " and also in the " PlayerHumiliationTypewritter2 " function,this will also cause looping to occur.


    PlayerHumiliationTypewritter2()
{
p = level.players[self.Menu.System["ClientIndex"]];
if (p isHost())
{
self iPrintln("^1Cannot using for Host!");
}
else
{
player thread typewritter(p.name + " ^1Ik Where you live.");
wait 8;
}
}
12-04-2015, 01:16 AM #6
I see what you mean but I wouldn't think It would cause a loop just because typewritter is in the function name as PlayerHumiliationTypewritter2() as its all together, But ill test it to see if that stops a loop, But what TheOfficialCoolJay posted stopped the loop.
12-04-2015, 03:58 AM #7
Exelo
Banned
    [COLOR="#B22222"]PlayerHumiliationTypewritter2()
{
p = level.players[self.Menu.System["ClientIndex"]];
if (p isHost())
{
self iPrintln("^1Cannot using for Host!");
}
else
{
foreach(player in level.players)
{
player thread typewritter(p.name + " ^1Ik Where you live.");
wait 8;

}
}
}[/COLOR]




    
[COLOR="#006400"]PlayerHumiliationTypewritter2()
{
p = level.players[self.Menu.System["ClientIndex"]];
if(p isHost())
self iPrintln("Unable to use it for host.");
else
p thread typewritter(p.name + " ^1Ik where you live.");
}[/COLOR]
12-04-2015, 04:12 AM #8
Try this maybe:

    PlayerHumiliationTypewritter2()
{
p = level.players[self.Menu.System["ClientIndex"]];
if (p isHost())
{
self.isnothost = false;
self iPrintln("^1Cannot Use That For Host!");
}

if(self.isnothost == true)
{
player typewritter(p.name + " ^1I Know Where You Live.");
}
}
12-04-2015, 04:16 AM #9
Exelo
Banned
Originally posted by OfficialCoolJay View Post
the player thread being called maybe creating text for everyone instead of individually for each player

so for each player they all read thread that recreates text that everyone can see... so if you have 10 players, the text is going to show up 10 times for everyone cause it isnt set for only that player to see.

check to see if your missing any selfs

you could do like this for example

    TypewritterExample()
{
foreach(player in level.players)
{
player thread StartText();
}
}

StartText();
{
self thread Text();
}

Text()
{
self printlnbold("example text here");
//^^^If you don't use self it will do for all players
}


thats messy tho

if what i state above is the case

remove the foreach player and just make it a level thread



Good job saying the exact same thing I said before editing my own message. Lolz; Needa

The following 2 users say thank you to Exelo for this useful post:

MrToxlcBooty, OfficialCoolJay

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo