View Single Post
bartek93tbg
Member
Join Date: Apr 2011
Location: Poland
Old 11-18-2011 , 10:31   Re: ZP 5.0 Betas/Updates
#662

Two bugs can be easily fixed.

Quote:
Originally Posted by bartek93tbg View Post
Another thing: ZP 5 doesn't prevent playing same gamemode twice in row.
1. Open zp50_gamemodes.sma
2. Add
Code:
new g_PreviousGameMode = ZP_NO_GAME_MODE
3. Find function public choose_game_mode() and add the lines with bold font:

Code:
public choose_game_mode()
{
    if (GetAliveCount() <= 0)
        return
    
    new index, filename[64]
    
    for (index = g_DefaultGameMode + 1; /*no condition*/; index++)
    {
        if (index >= g_GameModeCount)
            index = 0
        
        if (g_ChosenGameMode != ZP_NO_GAME_MODE)
        {
            ArrayGetString(g_GameModeFileName, g_ChosenGameMode, filename, charsmax(filename))
            pause("ac", filename)
        }
        
        g_ChosenGameMode = index
        
        ArrayGetString(g_GameModeFileName, g_ChosenGameMode, filename, charsmax(filename))
        unpause("ac", filename)

        if (index == g_PreviousGameMode)
            continue
        
        if (index != g_DefaultGameMode)
        {
            ExecuteForward(g_Forwards[FW_GAME_MODE_CHOOSE_PRE], g_ForwardResult, g_ChosenGameMode, false)
            
            if (g_ForwardResult < PLUGIN_HANDLED)
            {
                ExecuteForward(g_Forwards[FW_GAME_MODE_CHOOSE_POST], g_ForwardResult, g_ChosenGameMode, RANDOM_TARGET_PLAYER)
                break
            }
        }
        else
        {
            ExecuteForward(g_Forwards[FW_GAME_MODE_CHOOSE_PRE], g_ForwardResult, g_ChosenGameMode, true)
            
            if (g_ForwardResult < PLUGIN_HANDLED)
            {
                ExecuteForward(g_Forwards[FW_GAME_MODE_CHOOSE_POST], g_ForwardResult, g_ChosenGameMode, RANDOM_TARGET_PLAYER)
                break
            }
            else
            {
                abort(AMX_ERR_GENERAL, "[ZP] Default game mode can't be started. Check server settings.")
                break
            }
        }
    }
}
4. Find function named public start_game_mode_task() and add the line with bold font:

Code:
public start_game_mode_task()
{
    if (g_ChosenGameMode == ZP_NO_GAME_MODE)
        return
    
    g_CurrentGameMode = g_ChosenGameMode
    g_PreviousGameMode = g_ChosenGameMode
    
    ExecuteForward(g_Forwards[FW_GAME_MODE_START], g_ForwardResult, g_CurrentGameMode)
}
5. Compile.
Quote:
Originally Posted by bartek93tbg View Post
Yeah, sometimes in new round, before game mode starts, humans turn into zombies and they are in CT team and can't be killed. But in ZP 5.0.7 it seems it has been already fixed, because I didn't get this bug yet.
Quote:
Originally Posted by bartek93tbg View Post
Just got this bug again and it is not funny. I have noticed that it only happens at map start, so i will add some auto-restarts after map is loaded.
1. Open zp50_core.sma
2. Add
Code:
#include <zp50_gamemodes>
3. Find public fw_PlayerSpawn_Post(id) and add the line with bold font:
Code:
public fw_PlayerSpawn_Post(id)
{
    if (!is_user_alive(id) || !cs_get_user_team(id))
        return
    
    ExecuteForward(g_Forwards[FW_USER_SPAWN_POST], g_ForwardResult, id)
    
    if (flag_get(g_RespawnAsZombie, id) && (zp_gamemodes_get_current() != ZP_NO_GAME_MODE))
        InfectPlayer(id, id)
    else
        CurePlayer(id)
    
    flag_unset(g_RespawnAsZombie, id)
}
4. Compile


MeRcyLeZZ probably would do it better, but before it is officially fixed, you can use my solution. Hope I help you.
bartek93tbg is offline