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

[ReApi/ReGameDll] Unreal Spawn Fixer


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
karaulov
Senior Member
Join Date: Jul 2018
Old 12-28-2021 , 04:16   [ReApi/ReGameDll] Unreal Spawn Fixer
Reply With Quote #1

Plug-in can add "ignoring spawns count" for game.

Added possible to play any map with any spawn count. (For example with this plug-in you can play map with 8 spawn points at server with 32 players)

ReApi+ReGameDll is required.

Also need use semiclip, resemiclip, or internal semiclip.
Code:

Code:
#include <amxmodx>
#include <reapi>
#include <fakemeta>

#define USE_OWN_SEMICLIP_IF_NOT_FOUND

#define PLUGIN "Unreal Spawn Fixer"
#define AUTHOR "karaulov"

new maxplayers = 32;

public plugin_init()
{
   new VERSION[64] = "1.1";
   register_plugin(PLUGIN, VERSION, AUTHOR);
   
   RegisterHookChain(RG_CSGameRules_RestartRound, "RestartRound_Pre", false);
   RegisterHookChain(RG_CSGameRules_RestartRound, "RestartRound_Post", true);
   
   if (cvar_exists("resemiclip_version"))
   {
      add(VERSION,charsmax(VERSION),"_resemiclip");
      server_cmd("semiclip_option semiclip 1");
      server_cmd("semiclip_option time 0");
   }
   else if (cvar_exists("team_semiclip_version"))
   {
      add(VERSION,charsmax(VERSION),"_team_semiclip");
      set_cvar_num("semiclip",1);
      set_cvar_num("semiclip_block_team",0);
      set_cvar_num("semiclip_duration",0);
   }
   else
   {
      add(VERSION,charsmax(VERSION),"_semiclip");
#if defined USE_OWN_SEMICLIP_IF_NOT_FOUND
      register_forward(FM_PlayerPreThink, "preThink");
      register_forward(FM_PlayerPostThink, "postThink");
      register_forward(FM_AddToFullPack, "addToFullPack", 1);
      maxplayers = get_maxplayers();
#endif
   }
   
   register_cvar("unreal_spawn_fixer", VERSION, FCVAR_SERVER | FCVAR_SPONLY);
     
   set_member_game(m_bLevelInitialized,true);
   set_member_game(m_iSpawnPointCount_CT,32);
   set_member_game(m_iSpawnPointCount_Terrorist,32);
   
   set_cvar_float("mp_respawn_immunitytime",0.5);
   set_cvar_num("mp_respawn_immunity_force_unset",0);
   set_cvar_num("mp_kill_filled_spawn",0);
}

public RestartRound_Pre()
{
   if (cvar_exists("resemiclip_version"))
   {
      server_cmd("semiclip_option semiclip 1");
      server_cmd("semiclip_option time 0");
   }
   else if (cvar_exists("team_semiclip_version"))
   {
      set_cvar_num("semiclip",1);
      set_cvar_num("semiclip_block_team",0);
      set_cvar_num("semiclip_duration",0);
   }
   
   set_cvar_float("mp_respawn_immunitytime",0.5);
   set_cvar_num("mp_respawn_immunity_force_unset",0);
   set_cvar_num("mp_kill_filled_spawn",0);
}

public RestartRound_Post()
{
   set_member_game(m_bLevelInitialized,true);
   set_member_game(m_iSpawnPointCount_CT,32);
   set_member_game(m_iSpawnPointCount_Terrorist,32);
}

//AUTHOR "skyjur"
new bool:plrSolid[33]
new bool:plrRestore[33]
new plrTeam[33]

public addToFullPack(es, e, ent, host, hostflags, player, pSet)
{
   if(player)
   {
      if(plrSolid[host] && plrSolid[ent] && plrTeam[host] == plrTeam[ent])
      {
         set_es(es, ES_Solid, SOLID_NOT)
         set_es(es, ES_RenderMode, kRenderTransAlpha)
         set_es(es, ES_RenderAmt, 230)
      }
   }
}

FirstThink()
{
   for(new i = 1; i <= maxplayers; i++)
   {
      if(!is_user_alive(i))
      {
         plrSolid[i] = false
         continue
      }
     
      plrTeam[i] = get_user_team(i)
      plrSolid[i] = get_entvar(i, var_solid) == SOLID_SLIDEBOX ? true : false
   }
}

public preThink(id)
{
   static i, LastThink
   
   if(LastThink > id)
   {
      FirstThink()
   }
   LastThink = id

   
   if(!plrSolid[id]) return
   
   for(i = 1; i <= maxplayers; i++)
   {
      if(!plrSolid[i] || id == i) continue
     
      if(plrTeam[i] == plrTeam[id])
      {
         set_entvar(i, var_solid, SOLID_NOT)
         plrRestore[i] = true
      }
   }
}

public postThink(id)
{
   static i
   
   for(i = 1; i <= maxplayers; i++)
   {
      if(plrRestore[i])
      {
         set_entvar(i, var_solid, SOLID_SLIDEBOX)
         plrRestore[i] = false
      }
   }
}
For using it with hlds need replace reapi functions with alternative .

Last edited by karaulov; 07-16-2022 at 10:44.
karaulov is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 12-28-2021 , 04:49   Re: [ReApi/ReGameDll] Unreal Spawn Fixer
Reply With Quote #2

What do you need mp_respawn_immunitytime for?
__________________
JusTGo is offline
karaulov
Senior Member
Join Date: Jul 2018
Old 12-28-2021 , 06:31   Re: [ReApi/ReGameDll] Unreal Spawn Fixer
Reply With Quote #3

Not kill by worldspawn
karaulov is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 12-28-2021 , 08:54   Re: [ReApi/ReGameDll] Unreal Spawn Fixer
Reply With Quote #4

If you need reGameDLL for this plugin, why not use it's cvars?
PHP Code:
// Kill the player in filled spawn before spawning some one else (Prevents players stucking in each other).
// Only disable this if you have semiclip or other plugins that prevents stucking
// 0 - disabled
// 1 - enabled
//
// Default value: "1"
mp_kill_filled_spawn 1 
Also, don't hardcode:
Code:
new maxplayers = 32;
Not all servers has 32 players. Use get_maxplayers() or m_nMaxPlayers game member.
Code:
get_member_game(m_nMaxPlayers)
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 12-28-2021 at 08:58.
Shadows Adi is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 12-28-2021 , 21:14   Re: [ReApi/ReGameDll] Unreal Spawn Fixer
Reply With Quote #5

Its not hard coding since the game is already limited for 32 players max, but he need to initialize it as a constant.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 12-28-2021 at 21:15.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
karaulov
Senior Member
Join Date: Jul 2018
Old 12-28-2021 , 22:47   Re: [ReApi/ReGameDll] Unreal Spawn Fixer
Reply With Quote #6

Quote:
Originally Posted by Shadows Adi View Post
If you need reGameDLL for this plugin, why not use it's cvars?
PHP Code:
// Kill the player in filled spawn before spawning some one else (Prevents players stucking in each other).
// Only disable this if you have semiclip or other plugins that prevents stucking
// 0 - disabled
// 1 - enabled
//
// Default value: "1"
mp_kill_filled_spawn 1 
Also, don't hardcode:
Code:
new maxplayers = 32;
Not all servers has 32 players. Use get_maxplayers() or m_nMaxPlayers game member.
Code:
get_member_game(m_nMaxPlayers)
It initialized at maxplayers = get_maxplayers(); line. But it not using if server has TeamSemiclip or Resemiclip.

mp_kill_filled_spawn not adding more spawn points, and players can't join to any team.

Last edited by karaulov; 12-28-2021 at 22:56.
karaulov is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 12-29-2021 , 04:37   Re: [ReApi/ReGameDll] Unreal Spawn Fixer
Reply With Quote #7

You don't need mp_respawn_immunitytime if you set mp_kill_filled_spawn to 0.

mp_kill_filled_spawn disable worldspawn damage unless the map has other issues.
__________________
JusTGo is offline
Reply


Thread Tools
Display Modes

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 17:23.


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