CabConModding
Facebook
Twitter
youtube
Discord
Contact us
RSS
Menu
CabConModding
Home
New
Top
Premium
Rules
FAQ - Frequently Asked Questions
Games
Fornite
Call of Duty: Black Ops 3
Clash of Clans
Grand Theft Auto 5
Apex Legends
Assassin’s Creed Origins
Forums
Premium
Latest posts
What's new
Latest posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Log in
Register
What's new
Premium
Latest posts
Menu
Log in
Register
Navigation
Install the app
Install
More options
Dark Theme
Contact us
Close Menu
Forums
Gaming
Call of Duty Classics
Call of Duty: Black Ops 2
Call of Duty: Black Ops 2 Mods and Scripts
Call of Duty: Black Ops 2 Scripts
[NOOBS] "How to GSC"
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="The Dark Side" data-source="post: 9406" data-attributes="member: 49"><p>Just use a variable.</p><p></p><p>[CODE]</p><p>ToggleGod() //Call it like ::Togglegod</p><p>{</p><p> if(self.God==0) //Variable for the toggle.</p><p> {</p><p> self iPrintln("God Mode [^2ON^7]"); //Message telling you you turned it on.</p><p> self enableInvulnerability(); //The actual godmode.</p><p> self.God=1; //Setting variable to true, or 1.</p><p> }</p><p> else</p><p> {</p><p> self iPrintln("God Mode [^1OFF^7]"); //Message telling you you turned it off.</p><p> self disableInvulnerability(); //Godmode OFF</p><p> self.God=0; // Switching the variable back too 0. Or false.</p><p> }</p><p>}</p><p> [/CODE]</p><p></p><p>Now you could be pretty biased about this code here. Technically the "right way" to do it would be something like...</p><p></p><p>[CODE]godmode_toggle()</p><p>{</p><p> if(!isDefined(self.God) || !self.God)</p><p> self EnableInvulnerability();</p><p> else</p><p> self DisableInvulnerability();</p><p></p><p> self.God = !self.God;</p><p> self iPrintLn("Godmode " + self.God ? "Enabled" : "Disabled");</p><p>}[/CODE]</p><p></p><p>But since you're just starting out, you know. First one seems more simple. <img src="/styles/default/xenforo/smilies.emoji/people/stuck_out_tongue_winking_eye.emoji.svg" class="smilie" loading="lazy" alt=":tonguewink:" title="Tongue Wink :tonguewink:" data-shortname=":tonguewink:" /></p></blockquote><p></p>
[QUOTE="The Dark Side, post: 9406, member: 49"] Just use a variable. [CODE] ToggleGod() //Call it like ::Togglegod { if(self.God==0) //Variable for the toggle. { self iPrintln("God Mode [^2ON^7]"); //Message telling you you turned it on. self enableInvulnerability(); //The actual godmode. self.God=1; //Setting variable to true, or 1. } else { self iPrintln("God Mode [^1OFF^7]"); //Message telling you you turned it off. self disableInvulnerability(); //Godmode OFF self.God=0; // Switching the variable back too 0. Or false. } } [/CODE] Now you could be pretty biased about this code here. Technically the "right way" to do it would be something like... [CODE]godmode_toggle() { if(!isDefined(self.God) || !self.God) self EnableInvulnerability(); else self DisableInvulnerability(); self.God = !self.God; self iPrintLn("Godmode " + self.God ? "Enabled" : "Disabled"); }[/CODE] But since you're just starting out, you know. First one seems more simple. :P [/QUOTE]
Verification
Post reply
Forums
Gaming
Call of Duty Classics
Call of Duty: Black Ops 2
Call of Duty: Black Ops 2 Mods and Scripts
Call of Duty: Black Ops 2 Scripts
[NOOBS] "How to GSC"
CabConModding is now on facebook! Check the latest Updates, the Site Status and much more now!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top