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
Call of Duty: Black Ops 2 Scripts Questions
Call of Duty: Black Ops 2 Answered Questions
Hey There CabconModding!
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="TheHiddenHour" data-source="post: 9340" data-attributes="member: 7602"><p>The way that gamemodes work is by using the dvar "customgametype" and changing what is executed in the init function. For example-</p><p>[code]</p><p>//The actual init function that runs before everything else</p><p>init()</p><p>{</p><p> //If the dvar is set to "infected" then it will run the init function for infected</p><p> if(getDvar("customgametype") == "infected")</p><p> level thread infected_init();</p><p> else if(getDvar("customgametype") == "zombieland")//If the dvar is set to "zombieland" then it will run the init function for zombieland</p><p> level thread zombieland_init();</p><p>}</p><p></p><p>infected_init()</p><p>{</p><p> //setup infected gamemode</p><p> level thread infected_onPlayerConnect();</p><p>}</p><p></p><p>zombieland_init()</p><p>{</p><p> //setup zombieland gamemode</p><p> level thread zombieland_onPlayerConnect();</p><p>}</p><p>[/code]</p><p>To change between gamemodes, you'll need to make a function that sets "customgametype" and then restarts the map.</p><p>[code]</p><p>//Call in your menu like ::changeGamemode, "zombieland");</p><p>changeGamemode(dvar)</p><p>{</p><p> allClientsPrint("Changing to: ^2" + dvar);</p><p> wait 1;</p><p> setDvar("customgametype", dvar);</p><p> map_restart(false);</p><p>}</p><p>[/code]</p></blockquote><p></p>
[QUOTE="TheHiddenHour, post: 9340, member: 7602"] The way that gamemodes work is by using the dvar "customgametype" and changing what is executed in the init function. For example- [code] //The actual init function that runs before everything else init() { //If the dvar is set to "infected" then it will run the init function for infected if(getDvar("customgametype") == "infected") level thread infected_init(); else if(getDvar("customgametype") == "zombieland")//If the dvar is set to "zombieland" then it will run the init function for zombieland level thread zombieland_init(); } infected_init() { //setup infected gamemode level thread infected_onPlayerConnect(); } zombieland_init() { //setup zombieland gamemode level thread zombieland_onPlayerConnect(); } [/code] To change between gamemodes, you'll need to make a function that sets "customgametype" and then restarts the map. [code] //Call in your menu like ::changeGamemode, "zombieland"); changeGamemode(dvar) { allClientsPrint("Changing to: ^2" + dvar); wait 1; setDvar("customgametype", dvar); map_restart(false); } [/code] [/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
Call of Duty: Black Ops 2 Scripts Questions
Call of Duty: Black Ops 2 Answered Questions
Hey There CabconModding!
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