Raised This Month: $51 Target: $400
 12% 

[ALPHA] Scavenge Hardcore


Post New Thread Reply   
 
Thread Tools Display Modes
Author
eyal282
Veteran Member
Join Date: Aug 2011
Plugin ID:
8502
Plugin Version:
Plugin Category:
All
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Peak Scavenge gamemode
    Old 06-22-2023 , 14:53   [ALPHA] Scavenge Hardcore
    Reply With Quote #1

    server.cfg to compliment this plugin:

    Code:
    // Gameplay
    sm_cvar scavenge_round_setup_time 65535
    sm_cvar survivor_revive_health 100
    sm_cvar survivor_max_incapacitated_count 1
    sm_cvar z_ghost_delay_min 18
    sm_cvar z_ghost_delay_max 25
    sm_cvar z_ghost_speed 900
    sm_cvar vs_max_team_switches 5
    sm_cvar l4d2_karma_charge_slowmode 1
    sm_cvar sv_vote_plr_map_limit 69
    sm_cvar sv_vote_command_delay 0
    sm_cvar sv_vote_creation_timer 10
    sm_cvar l4d_takeover_manualincap 0
    sm_cvar l4d_climb_team 3
    ; Removes incap pistol from RPG-Perks.smx
    sm_cvar rpg_incap_pistol_priority 999
    Plugins to compliment this plugin:

    https://forums.alliedmods.net/showthread.php?t=161280
    https://forums.alliedmods.net/showthread.php?t=336225
    https://forums.alliedmods.net/showthread.php?p=2499388
    https://forums.alliedmods.net/showthread.php?p=2422153
    https://forums.alliedmods.net/showthread.php?p=1192594

    Mandatory Plugin, but edit its config in cfg/sourcemod/RPG-Perks.cfg:

    RPG-Perks.smx


    This plugin only works in Linux until Left4Dhooks decides to implement some changes I suggested.
    Attached Files
    File Type: sp Get Plugin or Get Source (ScavengeHardcore.sp - 46 views - 22.8 KB)
    __________________
    I am available to make plugins for pay.

    Discord: Eyal282#1334

    Last edited by eyal282; 07-11-2023 at 16:12.
    eyal282 is offline
    blueblur
    New Member
    Join Date: Nov 2022
    Old 07-10-2023 , 05:42   Re: [ALPHA] Scavenge Hardcore
    Reply With Quote #2

    Hello!
    I am hosting a confogl server which have a scavenge config. To solve the problem there are no gascans in the first round in the previous time, the method we used is trying to restart first round twice. the plugin detail can be found here:https://github.com/lechuga16/scavogl...eadyup_scav.sp

    After then I noticed this post and the function Scavenge_FixNoGascanSpawnBug(), so I tried to use your method to solve this.

    The plugin works great, gascan spawned properly in the first round, but only under the condition when you not
    using sm_forcematch in server.cfg to load a scavenge config when the server starts, otherwise you will meet some extremly wired bugs like:

    ① gascans spawned overflownly in the first round, but you can solve this by using sm_map to change map or just simply to end the first round.
    ② the match will never have an end with all the previous score being set to 0, you can keep playing round 6,7,8.. although a team has already win the match.

    I know these problems may not see to be so serious to be mentioned since the plugin itself runs well under the normal condition like a vanilla scavenge server or lunching the confogl config by using sm_match, I still want to report this issue.
    Here is the plugin detail I edited and extracted:
    PHP Code:
    #pragma newdecls required
    #pragma semicolon 1

    #include <sourcemod>
    #include <sdktools>
    #include <sdkhooks>
    #include <left4dhooks>
    #include <scavenge_func>

    float   g_fMapStartTime;

    ConVar  
        g_hGamemode
    ,
        
    l4d2_scavenge_rounds;

    public 
    Plugin myinfo =
    {
        
    name "[L4D2] Fix Scavenge Issues",
        
    author "Eyal282",
        
    description "Fix bug when first round start there are no gascans and set the round number",
        
    version "1.0",
        
    url ""
    }

    public 
    void OnPluginStart()
    {
        
    // ConVars
        
    g_hGamemode                 FindConVar("mp_gamemode");
        
    l4d2_scavenge_rounds        CreateConVar("l4d2_scavenge_rounds""5""Set the number of rounds"FCVAR_NOTIFYtrue1.0true5.0);

        
    // Hook
        
    HookEvent("scavenge_round_start"Event_ScavRoundStartEventHookMode_PostNoCopy);
        
    //HookEvent("scavenge_round_finished", Event_ScavRoundFinished, EventHookMode_PostNoCopy);
    }

    public 
    void OnMapStart()
    {
        
    g_fMapStartTime GetGameTime();
        
    CreateTimer(1.0Timer_Fix_TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
    }

    public 
    void Event_ScavRoundStart(Event event, const char[] namebool dontBroadcast)
    {
        
    // when round starts and the round number is the first round (round 1), sets the round limit.
        
    int round GetScavengeRoundNumber();
        if(
    round == 1)
        {
            
    SetScavengeRoundLimit(l4d2_scavenge_rounds.IntValue);
        }
    }

    public 
    Action Timer_Fix(Handle hTimer)
    {
        
    char sValue[32];
        
    g_hGamemode.GetString(sValuesizeof(sValue));

        if(
    StrEqual(sValue"scavenge") && GetGameTime() - g_fMapStartTime 5.0 &&  GetScavengeItemsRemaining() == && GetScavengeItemsGoal() == && GetGasCanCount() == 0)
        {
            
    Scavenge_FixNoGascanSpawnBug();
        }

        return 
    Plugin_Handled;
    }

    stock void Scavenge_FixNoGascanSpawnBug()
    {   
        
    char sSignature[128];
        
    sSignature "@_ZN9CDirector21SpawnAllScavengeItemsEv";
       
        
    Handle Call INVALID_HANDLE;
        if (
    Call == INVALID_HANDLE)
        {
            
    StartPrepSDKCall(SDKCall_Raw);
            if (!
    PrepSDKCall_SetSignature(SDKLibrary_ServersSignaturestrlen(sSignature)-1))
            {
                return;
            }

            
    Call EndPrepSDKCall();
            if (
    Call == INVALID_HANDLE)
            {
                return;
            }
        }

        
    SDKCall(CallL4D_GetPointer(POINTER_DIRECTOR));
    }

    stock int GetGasCanCount()
    {
        
    int count;
        
    int entCount GetEntityCount();

        for(
    int ent MaxClients 1ent entCountent++)
        {
            if(!
    IsValidEdict(ent))
                continue;

            
    char sClassname[64];
            
    GetEdictClassname(entsClassnamesizeof(sClassname));

            if(
    StrEqual(sClassname"weapon_gascan") || StrEqual(sClassname"weapon_gascan_spawn"))
                
    count++;
        }

        return 
    count;

    Some functions used from my include scavenge_func.inc:
    PHP Code:
    /*
    * Returns the current round number of current scavenge match.
    *
    * @return           Round numbers
    */
    stock int GetScavengeRoundNumber()
    {
        return 
    GameRules_GetProp("m_nRoundNumber");
    }

    /*
    * Sets the round limit.
    *
    * @param round        round limit to set. valid round number is 1, 3, 5.
    * @noreturn
    */
    stock void SetScavengeRoundLimit(int round)
    {
        
    GameRules_SetProp("m_nRoundLimit"round);
    }

    /*
    * Returns the amount of current remaining gascans.
    *
    * @return             amount of current remaining gascans
    */
    stock int GetScavengeItemsRemaining()
    {
        return 
    GameRules_GetProp("m_nScavengeItemsRemaining");
    }

    /*
    * Returns the goal amount of this match.
    *
    * @return             goal amount of this match
    */
    stock int GetScavengeItemsGoal()
    {
        return 
    GameRules_GetProp("m_nScavengeItemsGoal");

    Bug ① appears like this:

    Bug ② appears like this:

    (PS: the match score should be 3:0 since the round 3 had ended, but the game continued to begin round 4, and the previous round scores and match scores were all cleared to be 0)
    blueblur is offline
    eyal282
    Veteran Member
    Join Date: Aug 2011
    Old 07-10-2023 , 18:39   Re: [ALPHA] Scavenge Hardcore
    Reply With Quote #3

    Quote:
    Originally Posted by blueblur View Post
    Hello!
    I am hosting a confogl server which have a scavenge config. To solve the problem there are no gascans in the first round in the previous time, the method we used is trying to restart first round twice. the plugin detail can be found here:https://github.com/lechuga16/scavogl...eadyup_scav.sp

    After then I noticed this post and the function Scavenge_FixNoGascanSpawnBug(), so I tried to use your method to solve this.

    The plugin works great, gascan spawned properly in the first round, but only under the condition when you not
    using sm_forcematch in server.cfg to load a scavenge config when the server starts, otherwise you will meet some extremly wired bugs like:

    ① gascans spawned overflownly in the first round, but you can solve this by using sm_map to change map or just simply to end the first round.
    ② the match will never have an end with all the previous score being set to 0, you can keep playing round 6,7,8.. although a team has already win the match.

    I know these problems may not see to be so serious to be mentioned since the plugin itself runs well under the normal condition like a vanilla scavenge server or lunching the confogl config by using sm_match, I still want to report this issue.
    Here is the plugin detail I edited and extracted:
    PHP Code:
    #pragma newdecls required
    #pragma semicolon 1

    #include <sourcemod>
    #include <sdktools>
    #include <sdkhooks>
    #include <left4dhooks>
    #include <scavenge_func>

    float   g_fMapStartTime;

    ConVar  
        g_hGamemode
    ,
        
    l4d2_scavenge_rounds;

    public 
    Plugin myinfo =
    {
        
    name "[L4D2] Fix Scavenge Issues",
        
    author "Eyal282",
        
    description "Fix bug when first round start there are no gascans and set the round number",
        
    version "1.0",
        
    url ""
    }

    public 
    void OnPluginStart()
    {
        
    // ConVars
        
    g_hGamemode                 FindConVar("mp_gamemode");
        
    l4d2_scavenge_rounds        CreateConVar("l4d2_scavenge_rounds""5""Set the number of rounds"FCVAR_NOTIFYtrue1.0true5.0);

        
    // Hook
        
    HookEvent("scavenge_round_start"Event_ScavRoundStartEventHookMode_PostNoCopy);
        
    //HookEvent("scavenge_round_finished", Event_ScavRoundFinished, EventHookMode_PostNoCopy);
    }

    public 
    void OnMapStart()
    {
        
    g_fMapStartTime GetGameTime();
        
    CreateTimer(1.0Timer_Fix_TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
    }

    public 
    void Event_ScavRoundStart(Event event, const char[] namebool dontBroadcast)
    {
        
    // when round starts and the round number is the first round (round 1), sets the round limit.
        
    int round GetScavengeRoundNumber();
        if(
    round == 1)
        {
            
    SetScavengeRoundLimit(l4d2_scavenge_rounds.IntValue);
        }
    }

    public 
    Action Timer_Fix(Handle hTimer)
    {
        
    char sValue[32];
        
    g_hGamemode.GetString(sValuesizeof(sValue));

        if(
    StrEqual(sValue"scavenge") && GetGameTime() - g_fMapStartTime 5.0 &&  GetScavengeItemsRemaining() == && GetScavengeItemsGoal() == && GetGasCanCount() == 0)
        {
            
    Scavenge_FixNoGascanSpawnBug();
        }

        return 
    Plugin_Handled;
    }

    stock void Scavenge_FixNoGascanSpawnBug()
    {   
        
    char sSignature[128];
        
    sSignature "@_ZN9CDirector21SpawnAllScavengeItemsEv";
       
        
    Handle Call INVALID_HANDLE;
        if (
    Call == INVALID_HANDLE)
        {
            
    StartPrepSDKCall(SDKCall_Raw);
            if (!
    PrepSDKCall_SetSignature(SDKLibrary_ServersSignaturestrlen(sSignature)-1))
            {
                return;
            }

            
    Call EndPrepSDKCall();
            if (
    Call == INVALID_HANDLE)
            {
                return;
            }
        }

        
    SDKCall(CallL4D_GetPointer(POINTER_DIRECTOR));
    }

    stock int GetGasCanCount()
    {
        
    int count;
        
    int entCount GetEntityCount();

        for(
    int ent MaxClients 1ent entCountent++)
        {
            if(!
    IsValidEdict(ent))
                continue;

            
    char sClassname[64];
            
    GetEdictClassname(entsClassnamesizeof(sClassname));

            if(
    StrEqual(sClassname"weapon_gascan") || StrEqual(sClassname"weapon_gascan_spawn"))
                
    count++;
        }

        return 
    count;

    Some functions used from my include scavenge_func.inc:
    PHP Code:
    /*
    * Returns the current round number of current scavenge match.
    *
    * @return           Round numbers
    */
    stock int GetScavengeRoundNumber()
    {
        return 
    GameRules_GetProp("m_nRoundNumber");
    }

    /*
    * Sets the round limit.
    *
    * @param round        round limit to set. valid round number is 1, 3, 5.
    * @noreturn
    */
    stock void SetScavengeRoundLimit(int round)
    {
        
    GameRules_SetProp("m_nRoundLimit"round);
    }

    /*
    * Returns the amount of current remaining gascans.
    *
    * @return             amount of current remaining gascans
    */
    stock int GetScavengeItemsRemaining()
    {
        return 
    GameRules_GetProp("m_nScavengeItemsRemaining");
    }

    /*
    * Returns the goal amount of this match.
    *
    * @return             goal amount of this match
    */
    stock int GetScavengeItemsGoal()
    {
        return 
    GameRules_GetProp("m_nScavengeItemsGoal");

    Bug ① appears like this:

    Bug ② appears like this:

    (PS: the match score should be 3:0 since the round 3 had ended, but the game continued to begin round 4, and the previous round scores and match scores were all cleared to be 0)
    NGL, I don't think I'm gonna fix this specific interaction.
    __________________
    I am available to make plugins for pay.

    Discord: Eyal282#1334
    eyal282 is offline
    blueblur
    New Member
    Join Date: Nov 2022
    Old 07-13-2023 , 11:17   Re: [ALPHA] Scavenge Hardcore
    Reply With Quote #4

    Quote:
    Originally Posted by eyal282 View Post
    NGL, I don't think I'm gonna fix this specific interaction.
    I can understand it, anyway, thanks for the help. It's indeed a better way to play sacvenge!
    blueblur is offline
    Reply



    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 10:26.


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