02/05/2018, 03:18 PM
buenas ya hace tiempo que estuve retirado de esto y me decidí en editar un modo que encontré en el foro mis problemas son que al iniciar un servidor dedicado y dejarlo prendido por x minutos luego ingresar al servidor , escoger equipo pero esperar unos segundos a que me reviva lo cual no lo hace este modo ese es mi gran problema aparte quiero pedir si me pueden agregar otro método para bloquear el buy ya que esto lo encuentro que ocupa muchas lineas.
bueno eso es lo que quería pedir sin mas que decir dejo el code abajo.
bueno eso es lo que quería pedir sin mas que decir dejo el code abajo.
Código PHP:
/*================================================================================
[INICIO DEL MOD]
=================================================================================*/
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <engine>
#include <fun>
#include <fakemeta>
#define PLUGIN "Deathmatch"
#define VERSION "1.0"
#define AUTHOR "Skylar"
const OFFSET_JOINSTATE = 121;
const OFFSET_CSMENUCODE = 205;
// Cvars
new dm_revive, dm_proteccion
new HamHook:g_iHhCBasePlayerPreThink;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
/* = Hams = */
RegisterHam(Ham_Killed, "player", "Ham_PlayerKilled", 1)
DisableHamForward(g_iHhCBasePlayerPreThink = RegisterHam(Ham_Player_PreThink, "player", "OnHam__PlayerPreThink_Post", 1));
/* = Comandos */
register_clcmd("menuselect", "ClientCommand__MenuSelect");
register_clcmd("joinclass", "ClientCommand__MenuSelect");
register_clcmd("client_buy_open", "BloquearBuyMenu")
register_clcmd("buy", "BloquearComandos")
register_clcmd("buyammo1", "BloquearComandos")
register_clcmd("buyammo2", "BloquearComandos")
register_clcmd("buyequip", "BloquearComandos")
register_clcmd("cl_autobuy", "BloquearComandos")
register_clcmd("cl_rebuy", "BloquearComandos")
register_clcmd("cl_setautobuy", "BloquearComandos")
register_clcmd("cl_setrebuy", "BloquearComandos")
register_clcmd("drop", "BloquearComandos")
/* = Cvars = */
dm_revive = register_cvar("deathmatch_respawn", "3.0")
dm_proteccion = register_cvar("deathmatch_proteccion", "5.0")
remove_entity_name("func_bomb_target")
remove_entity_name("info_bomb_target")
}
/*================================================================================
[HAMS]
=================================================================================*/
public Ham_PlayerKilled(victim, attacker, shouldgib)
{
if(victim == attacker || !is_user_connected(attacker))
return
set_task(get_pcvar_float(dm_revive), "RevivirJugador", victim)
set_hudmessage(255, 0, 0, -1.0, -1.0, 1, 6.0, 3.0)
show_hudmessage(victim, "[DM] Reviviras en %d segundos", get_pcvar_num(dm_revive));
}
public OnHam__PlayerPreThink_Post(const id) {
DisableHamForward(g_iHhCBasePlayerPreThink);
if(!is_user_alive(id)) {
RevivirJugador(id);
}
}
/*================================================================================
[OTROS]
=================================================================================*/
public RevivirJugador(id)
{
ExecuteHamB(Ham_CS_RoundRespawn, id)
set_hudmessage(255, 255, 0, -1.0, -1.0, 1, 6.0, 4.0)
show_hudmessage(id, "[DM] Acabas de revivir.");
set_user_godmode(id, 1)
Print_Color(id, "!g[DM] !yObtienes proteccion por !g%d !ysegundos.", get_pcvar_num(dm_proteccion))
switch(cs_get_user_team(id)) {
case CS_TEAM_T: set_rendering(id, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 50)
case CS_TEAM_CT: set_rendering(id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 50)
}
set_task(get_pcvar_float(dm_proteccion), "RemoverProteccion", id)
}
public RemoverProteccion(id)
{
set_user_godmode(id, 0)
set_rendering(id)
Print_Color(id, "!g[DM] !ySe te acabaron los !g%d !ysegundos de proteccion.", get_pcvar_num(dm_proteccion))
}
public ClientCommand__MenuSelect(const id) {
if(get_pdata_int(id, OFFSET_CSMENUCODE) == 3 && get_pdata_int(id, OFFSET_JOINSTATE) == 4) {
EnableHamForward(g_iHhCBasePlayerPreThink);
}
}
public BloquearComandos(id) return PLUGIN_HANDLED
public BloquearBuyMenu(id)
{
static MsgBuyID
MsgBuyID = get_user_msgid("BuyClose")
message_begin(MSG_ONE, MsgBuyID, _, id)
message_end()
return PLUGIN_HANDLED
}
/*================================================================================
[STOCK'S]
=================================================================================*/
stock Print_Color(id, const input[], any:...)
{
static szMsg[191], msgSayText;
if(!msgSayText)
msgSayText = get_user_msgid("SayText");
vformat(szMsg, 190, input, 3);
replace_all(szMsg, 190, "!g", "^4");
replace_all(szMsg, 190, "!y", "^1");
replace_all(szMsg, 190, "!team", "^3");
message_begin(id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, msgSayText, .player = id);
write_byte(id ? id : 33);
write_string(szMsg);
message_end();
}