13/05/2020, 04:35 PM
(Última modificación: 13/05/2020, 04:36 PM por Valentina.. Edited 1 time in total.)
Código PHP:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#define PLUGIN "Simple Knife Warump"
#define VERSION "1.0"
#define AUTHOR "Sn!ff3r"
#define TASKID 1234
new hudtimer, cvar_timer, hudhandler, mp_freezetime, value
new bool:isCalentamiento;
new cvar_respawnTime;
new SOUND_1[] = "sounds/carpeta/sonido.mp3";
new SOUND_2[] = "sounds/carpeta/sonido2.mp3";
new SOUND_3[] = "sounds/carpeta/sonido3.mp3";
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_message(get_user_msgid("TextMsg") ,"message_TextMsg")
register_event("CurWeapon","switchweapon","be","1=1","2!29")
//register_dictionary("simple_warmup.txt")
cvar_timer = register_cvar("warmuptimer", "60") // Duracion del calentamiento
cvar_respawnTime = register_cvar("tiempo_respawn", "1.5") // Tiempo que tardarán en respawnear los usuarios
mp_freezetime = get_cvar_pointer("mp_freezetime")
hudhandler = CreateHudSyncObj()
}
public plugin_precache()
{
precache_generic(SOUND_1);
precache_generic(SOUND_2);
precache_generic(SOUND_3);
}
public plugin_cfg()
{
set_task(10.0, "read_vars")
}
public read_vars()
{
value = get_pcvar_num(mp_freezetime)
}
public message_TextMsg(const MsgId, const MsgDest, const MsgEntity)
{
static message[64]
get_msg_arg_string(2, message, charsmax(message))
if(equal(message, "#Game_Commencing"))
{
hudtimer = get_pcvar_num(cvar_timer)
if(hudtimer == -1)
return
//formatex(message, charsmax(message), "%L", LANG_PLAYER, "WARUMP_START") Tienes desactivado el diccionario a si que esto sobre :v
set_msg_arg_string(2, "Ha iniciado el calentamiento")
// client_cmd(id, "mp3 play ^"%s^"", sonido) es pa todos la musica xd
client_cmd(0, "mp3 play ^"%s^"", SOUND_1);
set_task(1.0, "restart", TASKID, _, _, "b")
set_pcvar_num(mp_freezetime, 0)
isCalentamiento = true;
}
if(equal(message, "#Game_will_restart_in"))
{
//formatex(message, charsmax(message), "%L", LANG_PLAYER, "WARUMP_END") Tienes desactivado el diccionario a si que esto sobre :v
client_cmd(0, "mp3 stop")
set_msg_arg_string(2, "Ha finalizado el calentamiento")
isCalentamiento = false;
}
}
public restart()
{
if(hudtimer <= 0)
{
remove_task(TASKID)
set_cvar_num("sv_restartround", 1)
set_pcvar_num(mp_freezetime, value)
}
else
{
if (hudtimer < 11)
client_cmd(0, "mp3 play ^"%s^"", SOUND_2);
else if (hudtimer < 6)
client_cmd(0, "mp3 play ^"%s^"", SOUND_3);
set_hudmessage(255, 255, 255, -1.0, 0.15, 0, float(get_pcvar_num(cvar_timer)), 1.0, 0.1, 0.2)
ShowSyncHudMsg(0, hudhandler, "Queda%s %i segundo%s para finalizar el calentamiento", hudtimer > 1 ? "n":"", hudtimer, hudtimer > 1 ? "s":"")
//ShowSyncHudMsg(0, hudhandler, "%L", LANG_PLAYER, "COUNTING", hudtimer) Tienes desactivado el diccionario a si que esto sobre :v
}
hudtimer--
}
public switchweapon(id)
{
if(task_exists(TASKID))
{
engclient_cmd(id, "weapon_knife")
}
}
public client_death(attacker, victim)
{
if(is_user_connected(victim) && isCalentamiento)
set_task(get_pcvar_float(cvar_respawnTime), "respawn", victim)
return PLUGIN_CONTINUE
}
public respawn(id)
{
if(isCalentamiento)
ExecuteHamB(Ham_CS_RoundRespawn, id)
}