Answered Toggle only can be used once

Status
Not open for further replies.

SlothWiiPlaza

Veteran
Messages
34
Reaction score
28
Points
793
Hello, i'm having a bit of problems with my Sky Text.

I want it so you can only toggle it once, this is causing problems in my lobbies when i spawn Sky Text and some n00b also toggles it, which causes lag.

Here's the toggle:
PHP:
swpSkyText()
{
 if( self.skytext == 0 )
 {
   self iprintlnbold(self.name + ": Skytext ^2Spawned");
   WP("skytextcodehere");   
    self.skytext = 1;
   }
   else
   {
   self iprintlnbold("^1Skytext already spawned!");
   }
  
}
 

Harry

Certified Sick ℂunt
Premium Member
Messages
1,253
Reaction score
942
Points
973
Or
if(!self.skytextspawned)
{
self.skytextspawned = true;
//stuff here
}
 

Richiecs

Known Member
Messages
2
Reaction score
0
Points
101
Code:
swpSkyText()
{
    if (isDefined(self.skytext) && self.skytext)
        self iPrintLnBold("^1Skytext already spawned!");
    else
    {
        self.skytext = true;
        WP("skytextcodehere");  
       
        self iPrintLnBold(self.name + ": Skytext ^2Spawned");
    }
}
 

VerTical

CEO
Donator
Messages
0
Reaction score
-86
Points
664
Code:
swpSkyText()
{
    if (isDefined(self.skytext) && self.skytext)
        self iPrintLnBold("^1Skytext already spawned!");
    else
    {
        self.skytext = true;
        WP("skytextcodehere"); 
      
        self iPrintLnBold(self.name + ": Skytext ^2Spawned");
    }
}
WHy, if (isDefined(self.skytext) && self.skytext) ? U Need only

if (isDefined(self.skytext))
 

SlothWiiPlaza

Veteran
Messages
34
Reaction score
28
Points
793
Both make it toggleable if it's already spawned

I want it so when someone toggled it everybody else can't.
 

DF_AUS

Moderator
Staff member
Head Staff Team
Donator
Messages
577
Reaction score
793
Points
878
Both make it toggleable if it's already spawned

I want it so when someone toggled it everybody else can't.
Code:
swpSkyText()
{
    if(!isDefined(level.skytext))
    {
       self iprintlnbold(self.name + ": Skytext ^2Spawned");
       WP("skytextcodehere");  
       level.skytext = true;
    }
    else
       self iprintlnbold("^1Skytext already spawned!");
}
 
Status
Not open for further replies.
Top