11/05/2019, 03:47 PM
(Última modificación: 12/05/2019, 02:15 AM por danips. Edited 1 time in total.)
Hola, nesesito que modifiquen este comando, que funcione tal como esta pero sin usar el comando por say /respawn, que funcione automaticamente
Código PHP:
//====================[*Includes*]===========================//
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
//====================[*Plugin Definitions*]===========================//
#define PLUGIN "Auto respawn"
#define VERSION "2.0"
#define AUTHOR "#8 SickneSS"
//====================[*Definitions*]===========================//
#define TASK_MSG 1437
#define TASK_RESPAWN 1337
#define valids_teams(%1) (CS_TEAM_T <= cs_get_user_team(%1) <= CS_TEAM_CT)
//====================[*Global Registrations*]===========================//
/* pCvars */
new enable
new delay
/* Boolean */
new bool:respawn[33]
//====================[*Plugin Start*]===========================//
public plugin_init() {
/* Plugin Registration */
register_plugin(PLUGIN, VERSION, AUTHOR)
/* Ham Registrations */
RegisterHam(Ham_Spawn, "player", "Ham_Spawn_player", 1)
RegisterHam(Ham_Killed, "player", "Ham_Killed_player", 1)
/* pCvar */
enable = register_cvar("respawn_enable","1")
delay = register_cvar("respawn_delay","3")
/* Commands */
register_clcmd("say /respawn","cmdRespawn")
register_clcmd("say_team /respawn","cmdRespawn")
}
//====================[*Respawn*]===========================//
public client_connect(id) {
respawn[id] = false
set_task(20.0, "cmdCanRespawn",id+TASK_MSG,_,_,"b")
}
//----------------------------------------------------------//
public cleint_disconnect(id) {
respawn[id] = false
}
//----------------------------------------------------------//
public cmdRespawn(id) {
if(get_pcvar_num(enable) == 1)
{
if(!valids_teams(id))
{
chat_color(id,"!g[Gamer Kingdom]!y Este comando esta deshabilitado para los espectadores.")
}
if(valids_teams(id))
{
respawn[id] = !respawn[id]
chat_color(id,"!g[Gamer Kingdom]!y Haz %sabilitado tu respawn.",respawn[id] ? "h" : "desh")
if(!is_user_alive(id)
|| respawn[id])
{
set_task(get_pcvar_float(delay),"cmdRespawns",id+TASK_RESPAWN)
}
}
}
return PLUGIN_HANDLED
}
//----------------------------------------------------------//
public Ham_Killed_player(id) {
if(get_pcvar_num(enable) == 1)
{
if(valids_teams(id)) {
if(respawn[id])
{
chat_color(id,"!g[Gamer Kingdom]!y Respawnearas en!team %d!y segundo%s.",get_pcvar_num(delay),get_pcvar_num(delay) < 2 ? "" : "s")
set_task(get_pcvar_float(delay),"cmdRespawns",id+TASK_RESPAWN)
}
else
{
chat_color(id,"!g[Gamer Kingdom]!y Para habilitar tu respawn,tipea !team/respawn!y.")
}
}
return HAM_IGNORED
}
return PLUGIN_HANDLED
}
//----------------------------------------------------------//
public Ham_Spawn_player(id) {
if(is_user_alive(id))
remove_task(id+TASK_RESPAWN)
}
//----------------------------------------------------------//
public cmdRespawns(id) {
id -= TASK_RESPAWN
if(!valids_teams(id)) {
respawn[id] = false
return PLUGIN_HANDLED
}
if(!is_user_alive(id)) {
ExecuteHamB(Ham_CS_RoundRespawn,id)
cs_set_user_money(id, 16000)
}
return PLUGIN_HANDLED
}
//----------------------------------------------------------//
public cmdCanRespawn(id) {
id -= TASK_MSG
if(get_pcvar_num(enable) == 1) {
if(is_user_alive(id)) {
remove_task(id+TASK_MSG)
}
else if(!is_user_alive(id)
|| valids_teams(id))
chat_color(id,"!g[Gamer Kingdom]!y Para habilitar tu respawn,tipea !team/respawn!y.")
}
}
//====================[*Stock*]===========================//
stock chat_color(const id, const input[], any:...) {
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!team", "^3")
replace_all(msg, 190, "!team2", "^0")
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
//====================[*Plugin End*]===========================//