ItsMods

Full Version: how stop the Loop?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
add self endon("mything");
to stop loop: self notify("mything"); ??
yep that should work this should also

add this to your onspawnedplayer

ie

Code:
onPlayerSpawned()
{
    self endon("disconnect");
    self thread hud_health();    
    for(;;)
    {
        self waittill("spawned_player");
        self.gotgun1 = 0;
}
}

then on the onMenuResponse add self.gotgun1++;
Code:
ie


        self.money-=1000;
        self.hud_score_value setValue(self.money);
        self giveWeapon( "l96a1_mp" );
        self switchToWeapon( "l96a1_mp" );
        self thread ScoreHUD( -1000);
        self iPrintln("L96 purchased");
        self.done1++;
tested and works but the notify thing should work to but my way you can control the player buying the gun twice and wasting moneys
(03-08-2012, 11:05)rotceh_dnih Wrote: [ -> ]yep that should work this should also

add this to your onspawnedplayer

ie

Code:
onPlayerSpawned()
{
    self endon("disconnect");
    self thread hud_health();    
    for(;;)
    {
        self waittill("spawned_player");
        self.gotgun1 = 0;
}
}

then on the onMenuResponse add self.gotgun1++;
Code:
ie


        self.money-=1000;
        self.hud_score_value setValue(self.money);
        self giveWeapon( "l96a1_mp" );
        self switchToWeapon( "l96a1_mp" );
        self thread ScoreHUD( -1000);
        self iPrintln("L96 purchased");
        self.done1++;
tested and works but the notify thing should work to but my way you can control the player buying the gun twice and wasting moneys

dont work still remove 6times money -.-
(03-08-2012, 10:38)Se7en Wrote: [ -> ]add self endon("mything");
to stop loop: self notify("mything"); ??

works 1 times,
but cant start the loop again.
soz i made a mistake edit it so it looks like this


Code:
if (response == "l96" && self.money >= 1000 && self.gotgun1 == 0 )
    
        {

        self.money-=1000;
        self.hud_score_value setValue(self.money);
        self giveWeapon( "l96a1_mp" );
        self switchToWeapon( "l96a1_mp" );
        self thread ScoreHUD( -1000);
        self iPrintln("L96 purchased");
        self.gotgun1++;

i tested it and that will work .
yes the first time it works,

but when im buying the gun.
and want to buy it again, it will not work
Use this instead:
Code:
if (response == "l96" && self.money >= 1000 && !self hasWeapon("l96a1_mp"))  )
Though I would also add the notify thing because it actually stops the loop, so it'll be more memory effecient or something.

PS: You're trying to add something to the AI Survival mod again, aren't you? Tongue
(03-08-2012, 16:00)Cyborgking Wrote: [ -> ]Use this instead:
Code:
if (response == "l96" && self.money >= 1000 && !self hasWeapon("l96a1_mp"))  )
Though I prefer the notify thing because it actually stops the loop, so it'll be more memory effecient or something.

PS: You're trying to add something to the AI Survival mod again, aren't you? Tongue

i need the option to buy it twice or more times!. i have option napalm(or anything)
so i cant buy more than 1 napalm, or buy a weapon to refillammo.
any other idears?
ok fix it,
explane it later

thanks anyway
(03-08-2012, 22:43)p2tk Wrote: [ -> ]ok fix it,
explane it later

thanks anyway

ok fit it with,

Quote:onMenuResponse()
{
self endon( "death" );
self endon( "disconnect" );


for(;;)
{
self waittill( "menuresponse", menu, response );





if (response == "say1" && self.money >= 500 && self.gotgun1 == 0 )
{
self.money -= 500;
self.hud_score_value setValue(self.money);
self sayAll( "Hi there bitches <3" );
self thread ScoreHUD( -500 );
self.gotgun1++;
}
}
}


openMenuThread()
{
self endon( "disconnect" );
while( true )
{
if( self useButtonPressed() )
self openMenu( game[ "exi_menu" ] );
self.gotgun1 = 0;
wait( 0.05 );

}
}

onPlayerSpawned()
{
self endon("disconnect");
for(;;)
{
self waittill("spawned_player");
self thread onMenuResponse();
self.gotgun1 = 0;
}
}

so but i get in all other function bug
-.- and it crash after some rounds
Pages: 1 2 3