AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Costume Gamemodes Map (https://forums.alliedmods.net/showthread.php?t=338157)

ALonsoVIP4141 06-11-2022 17:03

Costume Gamemodes Map
 
Welcome,

I want to know how to select a specific map in which Game modes like nemesis and etc are activated

Example:

if the map started with ( de_ ) will be only for Game modes like nemesis and assassin and etc......


Zombie Plague 5.0

Supremache 06-11-2022 17:09

Re: Costume Gamemodes Map
 
Quote:

Originally Posted by ALonsoVIP4141 (Post 2781497)
Welcome,

I want to know how to select a specific map in which Game modes like nemesis and etc are activated

Example:

if the map started with ( de_ ) will be only for Game modes like nemesis and assassin and etc......


Zombie Plague 5.0

PHP Code:

RunMod( .... )
{
    if( 
IsMapAvailable"de_" ) )
    {
        
// Your code.....
    
}
}

bool:IsMapAvailable( const szMapHandler[ ] )
{
    new 
szMap32 ];
    
get_mapnameszMapcharsmaxszMap ) )
    return ( 
containszMapszMapHandler ) != ) ? true false



ZaX 06-12-2022 01:29

Re: Costume Gamemodes Map
 
https://wiki.alliedmods.net/Configur...ecific_Plugins

ALonsoVIP4141 06-12-2022 18:08

Re: Costume Gamemodes Map
 
Quote:

Originally Posted by Supremache (Post 2781498)
PHP Code:

RunMod( .... )
{
    if( 
IsMapAvailable"de_" ) )
    {
        
// Your code.....
    
}
}

bool:IsMapAvailable( const szMapHandler[ ] )
{
    new 
szMap32 ];
    
get_mapnameszMapcharsmaxszMap ) )
    return ( 
containszMapszMapHandler ) != ) ? true false




Can i have an example for im not rely good at ZP 5.0

Supremache 06-12-2022 18:19

Re: Costume Gamemodes Map
 
Quote:

Originally Posted by ALonsoVIP4141 (Post 2781577)
Can i have an example for im not rely good at ZP 5.0

Open the plugin with the name "zp50_gamemode_nemesis.sma" and replace this function

PHP Code:

public plugin_precache()
{
    
// Register game mode at precache (plugin gets paused after this)
    
register_plugin("[ZP] Game Mode: Nemesis"ZP_VERSION_STRING"ZP Dev Team")
    
zp_gamemodes_register("Nemesis Mode")
    
    
// Create the HUD Sync Objects
    
g_HudSync CreateHudSyncObj()
    
    
g_MaxPlayers get_maxplayers()
    
    
cvar_nemesis_chance register_cvar("zp_nemesis_chance""20")
    
cvar_nemesis_min_players register_cvar("zp_nemesis_min_players""0")
    
cvar_nemesis_show_hud register_cvar("zp_nemesis_show_hud""1")
    
cvar_nemesis_sounds register_cvar("zp_nemesis_sounds""1")
    
cvar_nemesis_allow_respawn register_cvar("zp_nemesis_allow_respawn""0")
    
    
// Initialize arrays
    
g_sound_nemesis ArrayCreate(SOUND_MAX_LENGTH1)
    
    
// Load from external file
    
amx_load_setting_string_arr(ZP_SETTINGS_FILE"Sounds""ROUND NEMESIS"g_sound_nemesis)
    
    
// If we couldn't load custom sounds from file, use and save default ones
    
new index
    
if (ArraySize(g_sound_nemesis) == 0)
    {
        for (
index 0index sizeof sound_nemesisindex++)
            
ArrayPushString(g_sound_nemesissound_nemesis[index])
        
        
// Save to external file
        
amx_save_setting_string_arr(ZP_SETTINGS_FILE"Sounds""ROUND NEMESIS"g_sound_nemesis)
    }
    
    
// Precache sounds
    
new sound[SOUND_MAX_LENGTH]
    for (
index 0index ArraySize(g_sound_nemesis); index++)
    {
        
ArrayGetString(g_sound_nemesisindexsoundcharsmax(sound))
        if (
equal(sound[strlen(sound)-4], ".mp3"))
        {
            
format(soundcharsmax(sound), "sound/%s"sound)
            
precache_generic(sound)
        }
        else
            
precache_sound(sound)
    }


:arrow:

PHP Code:

public plugin_precache()
{
    if( !
IsMapAvailable"de_" ) )
    {
        return; 
// If the map is not "de_*" blocks this plugin.
    
}

    
// Register game mode at precache (plugin gets paused after this)
    
register_plugin("[ZP] Game Mode: Nemesis"ZP_VERSION_STRING"ZP Dev Team")
    
zp_gamemodes_register("Nemesis Mode")
    
    
// Create the HUD Sync Objects
    
g_HudSync CreateHudSyncObj()
    
    
g_MaxPlayers get_maxplayers()
    
    
cvar_nemesis_chance register_cvar("zp_nemesis_chance""20")
    
cvar_nemesis_min_players register_cvar("zp_nemesis_min_players""0")
    
cvar_nemesis_show_hud register_cvar("zp_nemesis_show_hud""1")
    
cvar_nemesis_sounds register_cvar("zp_nemesis_sounds""1")
    
cvar_nemesis_allow_respawn register_cvar("zp_nemesis_allow_respawn""0")
    
    
// Initialize arrays
    
g_sound_nemesis ArrayCreate(SOUND_MAX_LENGTH1)
    
    
// Load from external file
    
amx_load_setting_string_arr(ZP_SETTINGS_FILE"Sounds""ROUND NEMESIS"g_sound_nemesis)
    
    
// If we couldn't load custom sounds from file, use and save default ones
    
new index
    
if (ArraySize(g_sound_nemesis) == 0)
    {
        for (
index 0index sizeof sound_nemesisindex++)
            
ArrayPushString(g_sound_nemesissound_nemesis[index])
        
        
// Save to external file
        
amx_save_setting_string_arr(ZP_SETTINGS_FILE"Sounds""ROUND NEMESIS"g_sound_nemesis)
    }
    
    
// Precache sounds
    
new sound[SOUND_MAX_LENGTH]
    for (
index 0index ArraySize(g_sound_nemesis); index++)
    {
        
ArrayGetString(g_sound_nemesisindexsoundcharsmax(sound))
        if (
equal(sound[strlen(sound)-4], ".mp3"))
        {
            
format(soundcharsmax(sound), "sound/%s"sound)
            
precache_generic(sound)
        }
        else
            
precache_sound(sound)
    }
}
bool:IsMapAvailable( const szMapHandler[ ] )
{
    new 
szMap32 ];
    
get_mapnameszMapcharsmaxszMap ) )
    return ( 
containszMapszMapHandler ) != ) ? true false


Or use another method that was shared by ZaX
Create a new file in this location addons/amxmodx/configs/maps with name "plugins-de.ini" and type the name of the plugin that you want to make it work on "de" maps like this:

zp50_gamemode_nemesis.amxx
zp50_gamemode_survivor.amxx
etc...

Note: If you are going to use the second method, remember to remove the plugin you added in "plugins-de.ini" from "plugins.ini"

ALonsoVIP4141 06-12-2022 18:31

Re: Costume Gamemodes Map
 
Quote:

Originally Posted by Supremache (Post 2781578)
Open the plugin with the name "zp50_gamemode_nemesis.sma" and replace this function

PHP Code:

public plugin_precache()
{
    
// Register game mode at precache (plugin gets paused after this)
    
register_plugin("[ZP] Game Mode: Nemesis"ZP_VERSION_STRING"ZP Dev Team")
    
zp_gamemodes_register("Nemesis Mode")
    
    
// Create the HUD Sync Objects
    
g_HudSync CreateHudSyncObj()
    
    
g_MaxPlayers get_maxplayers()
    
    
cvar_nemesis_chance register_cvar("zp_nemesis_chance""20")
    
cvar_nemesis_min_players register_cvar("zp_nemesis_min_players""0")
    
cvar_nemesis_show_hud register_cvar("zp_nemesis_show_hud""1")
    
cvar_nemesis_sounds register_cvar("zp_nemesis_sounds""1")
    
cvar_nemesis_allow_respawn register_cvar("zp_nemesis_allow_respawn""0")
    
    
// Initialize arrays
    
g_sound_nemesis ArrayCreate(SOUND_MAX_LENGTH1)
    
    
// Load from external file
    
amx_load_setting_string_arr(ZP_SETTINGS_FILE"Sounds""ROUND NEMESIS"g_sound_nemesis)
    
    
// If we couldn't load custom sounds from file, use and save default ones
    
new index
    
if (ArraySize(g_sound_nemesis) == 0)
    {
        for (
index 0index sizeof sound_nemesisindex++)
            
ArrayPushString(g_sound_nemesissound_nemesis[index])
        
        
// Save to external file
        
amx_save_setting_string_arr(ZP_SETTINGS_FILE"Sounds""ROUND NEMESIS"g_sound_nemesis)
    }
    
    
// Precache sounds
    
new sound[SOUND_MAX_LENGTH]
    for (
index 0index ArraySize(g_sound_nemesis); index++)
    {
        
ArrayGetString(g_sound_nemesisindexsoundcharsmax(sound))
        if (
equal(sound[strlen(sound)-4], ".mp3"))
        {
            
format(soundcharsmax(sound), "sound/%s"sound)
            
precache_generic(sound)
        }
        else
            
precache_sound(sound)
    }


:arrow:

PHP Code:

public plugin_precache()
{
    if( !
IsMapAvailable"de_" ) )
    {
        return; 
// If the map is not "de_*" blocks this plugin.
    
}

    
// Register game mode at precache (plugin gets paused after this)
    
register_plugin("[ZP] Game Mode: Nemesis"ZP_VERSION_STRING"ZP Dev Team")
    
zp_gamemodes_register("Nemesis Mode")
    
    
// Create the HUD Sync Objects
    
g_HudSync CreateHudSyncObj()
    
    
g_MaxPlayers get_maxplayers()
    
    
cvar_nemesis_chance register_cvar("zp_nemesis_chance""20")
    
cvar_nemesis_min_players register_cvar("zp_nemesis_min_players""0")
    
cvar_nemesis_show_hud register_cvar("zp_nemesis_show_hud""1")
    
cvar_nemesis_sounds register_cvar("zp_nemesis_sounds""1")
    
cvar_nemesis_allow_respawn register_cvar("zp_nemesis_allow_respawn""0")
    
    
// Initialize arrays
    
g_sound_nemesis ArrayCreate(SOUND_MAX_LENGTH1)
    
    
// Load from external file
    
amx_load_setting_string_arr(ZP_SETTINGS_FILE"Sounds""ROUND NEMESIS"g_sound_nemesis)
    
    
// If we couldn't load custom sounds from file, use and save default ones
    
new index
    
if (ArraySize(g_sound_nemesis) == 0)
    {
        for (
index 0index sizeof sound_nemesisindex++)
            
ArrayPushString(g_sound_nemesissound_nemesis[index])
        
        
// Save to external file
        
amx_save_setting_string_arr(ZP_SETTINGS_FILE"Sounds""ROUND NEMESIS"g_sound_nemesis)
    }
    
    
// Precache sounds
    
new sound[SOUND_MAX_LENGTH]
    for (
index 0index ArraySize(g_sound_nemesis); index++)
    {
        
ArrayGetString(g_sound_nemesisindexsoundcharsmax(sound))
        if (
equal(sound[strlen(sound)-4], ".mp3"))
        {
            
format(soundcharsmax(sound), "sound/%s"sound)
            
precache_generic(sound)
        }
        else
            
precache_sound(sound)
    }
}
bool:IsMapAvailable( const szMapHandler[ ] )
{
    new 
szMap32 ];
    
get_mapnameszMapcharsmaxszMap ) )
    return ( 
containszMapszMapHandler ) != ) ? true false


Or use another method that was shared by ZaX
Create a new file in this location addons/amxmodx/configs/maps with name "plugins-de.ini" and type the name of the plugin that you want to make it work on "de" maps like this:

zp50_gamemode_nemesis.amxx
zp50_gamemode_survivor.amxx
etc...

Note: If you are going to use the second method, remember to remove the plugin you added in "plugins-de.ini" from "plugins.ini"



Thanks for the quick reply.. :D

I will try both ways


All times are GMT -4. The time now is 21:23.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.