Raised This Month: $ Target: $400
 0% 

[ReApi/ReGameDll] Unreal Spawn Fixer


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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:08.


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