//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();
}
//Call in your menu like ::changeGamemode, "zombieland");
changeGamemode(dvar)
{
allClientsPrint("Changing to: ^2" + dvar);
wait 1;
setDvar("customgametype", dvar);
map_restart(false);
}
Could you help me out on skype please?The way that gamemodes work is by using the dvar "customgametype" and changing what is executed in the init function. For example-
To change between gamemodes, you'll need to make a function that sets "customgametype" and then restarts the map.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://Call in your menu like ::changeGamemode, "zombieland"); changeGamemode(dvar) { allClientsPrint("Changing to: ^2" + dvar); wait 1; setDvar("customgametype", dvar); map_restart(false); }