Плъгин Spawn protection

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
cgozzie
Извън линия
Потребител
Потребител
Мнения: 1318
Регистриран на: 13 Окт 2016, 22:10
Местоположение: Варна
Се отблагодари: 244 пъти
Получена благодарност: 42 пъти

Плъгин Spawn protection

Мнение от cgozzie » 01 Мар 2018, 23:50

Може ли да ми изработите плъгин Spawn protection като в csdm искам да е само за CT да имат тази защита за 5 сек.

Намерих този дали ще може да се преработи да е само за CT.

Код за потвърждение: Избери целия код

//----------------------------------------------------------//
/* CREDITS :
      Thanks to Xeroblood, JJkiller, KingPin for helping me make
      this plugin and Firestorm for helping adding a lot of things

   INSTALLING :
      Download .SMA to Scripting folder, run compiler, copy the
      file from Compiled folder and paste in Plugins folder, add the plugin name
      in the Amxx plugins.ini ie : spawnprotection.amxx

   DESCRIPTION :
      Protects players when the spawn from being killed

   CHANGELOG :
      Version 1.0 - First Release
      Version 2.0 - Fixed godmode cvar problems
      Version 3.0 - Added message time control cvar
      Version 4.0 - Fixed errors
      Version 5.0 - Added message control cvar
      Version 6.0 - Fixed errors - THANKS VEN!
      Version 7.0 - Cleaned up plugin and fixed errors - THANKS
                    AVALANCHE, VEN and SubStream!
*/
//----------------------------------------------------------//
#include <amxmodx>
#include <amxmisc>
#include <fun>
//----------------------------------------------------------//
public plugin_init()
{
   register_plugin("Spawn Protection", "7.0", "Peli") // Plugin Information
   register_concmd("amx_sptime", "cmd_sptime", ADMIN_CVAR, "1 through 10 to set Spawn Protection time") // Concmd (Console Command) for the CVAR time
   register_concmd("amx_spmessage", "cmd_spmessage", ADMIN_CVAR, "1 = Turn Spawn Protection Message on , 0 = Turn Spawn Protection message off") // Concmd for the CVAR message
   register_concmd("amx_spshellthickness", "cmd_spshellthickness", ADMIN_CVAR, "1 through 100 to set Glow Shellthickness") // Concmd for the shellthickness
   register_cvar("sv_sp", "1") // Cvar (Command Variable) for the plugin on/off
   register_cvar("sv_sptime", "5") // Cvar for controlling the message time (1-10 seconds)
   register_cvar("sv_spmessage", "1") // Cvar for controlling the message on/off
   register_cvar("sv_spshellthick", "25") // Cvar for controlling the glow shell thickness
   register_event("ResetHUD", "sp_on", "be")
   register_clcmd("fullupdate", "clcmd_fullupdate")
}
//----------------------------------------------------------//
public client_disconnect(id)
{
   remove_task(id)
   return PLUGIN_HANDLED
}
//----------------------------------------------------------//
public cmd_sptime(id, level, cid) // This is the function for the cvar time control
{
   if(!cmd_access(id, level, cid, 2))
   return PLUGIN_HANDLED

   new arg_str[3]
   read_argv(1, arg_str, 3)
   new arg = str_to_num(arg_str)

   if(arg > 10 || arg < 1)
   {
      client_print(id, print_chat, "You have to set the Spawn Protection time between 1 and 10 seconds")
      return PLUGIN_HANDLED
   }

   else if (arg > 0 || arg < 11)
   {
      set_cvar_num("sv_sptime", arg)
      client_print(id, print_chat, "You have set the Spawn Protection time to %d second(s)", arg)
      return PLUGIN_HANDLED
   }
   return PLUGIN_CONTINUE
}
//----------------------------------------------------------//
public cmd_spmessage(id, level, cid) // This is the function for the cvar message control
{
   if (!cmd_access(id, level, cid, 2))
   {
      return PLUGIN_HANDLED
   }

   new sp[3]
   read_argv(1, sp, 2)

   if (sp[0] == '1')
   {
      set_cvar_num("amx_spmessage", 1)
   }

   else if (sp[0] == '0')
   {
      set_cvar_num("amx_spmessage", 0)
   }

   else if (sp[0] != '1' || sp[0] != '0')
   {
      console_print(id, "Usage : amx_spmessage 1 = Messages ON | 0 = Messages OFF")
      return PLUGIN_HANDLED
   }

   return PLUGIN_HANDLED
}
//----------------------------------------------------------//
public cmd_spshellthickness(id, level, cid)
{
   if(!cmd_access(id, level, cid, 2))
   return PLUGIN_HANDLED

   new arg_str[3]
   read_argv(1, arg_str, 3)
   new arg = str_to_num(arg_str)

   if(arg > 100 || arg < 1)
   {
      client_print(id, print_chat, "You have to set the Glow Shellthickness between 1 and 100")
      return PLUGIN_HANDLED
   }

   else if (arg > 0 || arg < 101)
   {
      set_cvar_num("sv_spshellthickness", arg)
      client_print(id, print_chat, "You have set the Glow Shellthickness to %d", arg)
      return PLUGIN_HANDLED
   }
   return PLUGIN_CONTINUE
}
//----------------------------------------------------------//
public sp_on(id) // This is the function for the event godmode
{
   if(get_cvar_num("sv_sp") == 1)
   {
      set_task(0.1, "protect", id)
   }

   return PLUGIN_CONTINUE
}
//----------------------------------------------------------//
public protect(id) // This is the function for the task_on godmode
{
   new Float:SPTime = get_cvar_float("sv_sptime")
   new SPSecs = get_cvar_num("sv_sptime")
   new FTime = get_cvar_num("mp_freezetime")
   new SPShell = get_cvar_num("sv_spshellthick")
   set_user_godmode(id, 1)

   if(get_user_team(id) == 1)
   {
      set_user_rendering(id, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, SPShell)
   }

   if(get_user_team(id) == 2)
   {
      set_user_rendering(id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, SPShell)
   }

   if(get_cvar_num("sv_spmessage") == 1)
   {
      set_hudmessage(255, 1, 1, -1.0, -1.0, 0, 6.0, SPTime+FTime, 0.1, 0.2, 4)
      show_hudmessage(id, "Spawn Protection is enabled for %d second(s)", SPSecs)
   }

   set_task(SPTime+FTime, "sp_off", id)
   return PLUGIN_HANDLED
}
//----------------------------------------------------------//
public sp_off(id) // This is the function for the task_off godmode
{
   new SPShell = get_cvar_num("sv_spshellthick")
   if(!is_user_connected(id))
   {
      return PLUGIN_HANDLED
   }

   else
   {
      set_user_godmode(id, 0)
      set_user_rendering(id, kRenderFxGlowShell, 0, 0,0, kRenderNormal, SPShell)
      return PLUGIN_HANDLED
   }

   return PLUGIN_HANDLED
}
//----------------------------------------------------------//
public clcmd_fullupdate(id)
{
   return PLUGIN_HANDLED
}
//----------------------------------------------------------//
Изображение

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

Плъгин Spawn protection

Мнение от OciXCrom » 02 Мар 2018, 03:05

Този който си дал е ужас. Ползвай този - viewtopic.php?f=21&t=1120

Аватар
cgozzie
Извън линия
Потребител
Потребител
Мнения: 1318
Регистриран на: 13 Окт 2016, 22:10
Местоположение: Варна
Се отблагодари: 244 пъти
Получена благодарност: 42 пъти

Плъгин Spawn protection

Мнение от cgozzie » 02 Мар 2018, 11:22

Ок но може ли да е само за CT не искам на Т да имат.
Изображение

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

Плъгин Spawn protection

Мнение от OciXCrom » 02 Мар 2018, 17:04

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <fun>
#include <hamsandwich>

#define PLUGIN_VERSION "1.0.1"
#define TASK_PROTECT 222567

enum _:Cvars
{
	sp_time,
	sp_glow_t,
	sp_glow_ct,
	sp_glow_spec,
	sp_glow_alpha
}

new g_eCvars[Cvars]

new g_iAlpha
new g_iColors[3][3]
new Float:g_fTime
new bool:g_bProtect[33]

public plugin_init()
{
	register_plugin("Spawn Protection", PLUGIN_VERSION, "OciXCrom")
	register_cvar("CRXSpawnProtection", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
	RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1)
	RegisterHam(Ham_TraceAttack, "player", "OnPlayerAttack")
	
	g_eCvars[sp_time] = register_cvar("sp_time", "1.0")
	g_eCvars[sp_glow_t] = register_cvar("sp_glow_t", "255 0 0")
	g_eCvars[sp_glow_ct] = register_cvar("sp_glow_ct", "0 0 255")
	g_eCvars[sp_glow_spec] = register_cvar("sp_glow_spec", "255 255 255")
	g_eCvars[sp_glow_alpha] = register_cvar("sp_glow_alpha", "40")
}

public plugin_cfg()
{
	g_iAlpha = get_pcvar_num(g_eCvars[sp_glow_alpha])
	g_fTime = get_pcvar_float(g_eCvars[sp_time])
	
	new szColor[12]
	get_pcvar_string(g_eCvars[sp_glow_spec], szColor, charsmax(szColor))
	parse_color(szColor, g_iColors[0][0], g_iColors[0][1], g_iColors[0][2])
	get_pcvar_string(g_eCvars[sp_glow_t], szColor, charsmax(szColor))
	parse_color(szColor, g_iColors[1][0], g_iColors[1][1], g_iColors[1][2])
	get_pcvar_string(g_eCvars[sp_glow_ct], szColor, charsmax(szColor))
	parse_color(szColor, g_iColors[2][0], g_iColors[2][1], g_iColors[2][2])
}

public OnPlayerAttack(iVictim, iAttacker)
	return g_bProtect[iVictim] ? HAM_SUPERCEDE : HAM_IGNORED

public OnPlayerSpawn(id)
{
	if(!is_user_alive(id))
		return
		
	new iTeam = get_user_team(id)
	
	if(iTeam != 2)
		return
		
	g_bProtect[id] = true	
	
	if(iTeam > 2)
		iTeam = 0
		
	set_user_rendering(id, kRenderFxGlowShell, g_iColors[iTeam][0], g_iColors[iTeam][1], g_iColors[iTeam][2], kRenderNormal, g_iAlpha)
	set_task(g_fTime, "RemoveProtection", id + TASK_PROTECT)
}

public RemoveProtection(id)
{
	id -= TASK_PROTECT
	g_bProtect[id] = false
	
	if(is_user_connected(id))
		set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 0)
}

parse_color(szRGB[], &iRed, &iGreen, &iBlue)
{
	new szColor[3][4]
	parse(szRGB, szColor[0], charsmax(szColor[]), szColor[1], charsmax(szColor[]), szColor[2], charsmax(szColor[]))
	iRed = str_to_num(szColor[0])
	iGreen = str_to_num(szColor[1])
	iBlue = str_to_num(szColor[2])
}

Аватар
cgozzie
Извън линия
Потребител
Потребител
Мнения: 1318
Регистриран на: 13 Окт 2016, 22:10
Местоположение: Варна
Се отблагодари: 244 пъти
Получена благодарност: 42 пъти

Плъгин Spawn protection

Мнение от cgozzie » 02 Мар 2018, 19:18

Благодаря работи може да заключиш темата.
Изображение

Заключено
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: Bing [Bot] и 16 госта