Answered Hey There CabconModding!

UnsignedGlitch

#C?
Donator
Messages
132
Reaction score
62
Points
653
Im trying to add a list of Gamemodes to my modmenu and I was wondering if someone could help me out?
credit will be given!
Thanks in advance
-AMT
 

TheHiddenHour

Veteran
Messages
57
Reaction score
49
Points
578
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();
}
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);
}
 

UnsignedGlitch

#C?
Donator
Messages
132
Reaction score
62
Points
653
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();
}
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);
}
Could you help me out on skype please?
 
Top