Код за потвърждение: Избери целия код
/*
*
*
* * * ***** ***** * ***** * * ***** * * * *
* * * * * * * * * * ** * * ** * * * *
* ****** ****** ****** * * ****** * * * * * * * * * * *
* * * * * ******* * * * * * * * * * * * *
* * * ***** ***** * * ***** * * ***** * * * *
*
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* AMX Mod X script. *
* Plugin made by He3aBuCuM(a.k.a. independent). *
* Important! You can modify the code, but DO NOT modify the author! *
* Contacts with me: *
* E-mail: [email protected] *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* * * * * * * * * * * * * * * * * * * * * * * *
* Special thanks to: *
* [email protected] - for the idea *
* * * * * * * * * * * * * * * * * * * * * * * *
*
*
*/
#include <amxmodx>
#define ARIXR_VERSION "0.3"
new cRound, cvar_rounds, cvar_time, cvar_notice, cvar_message, cvar_message_color, cvar_hud, cvar_hud_color, cvar_sound, cvar_restart, hudsync, counter
new prefix[] = "ARIXR"
/*START - From colorchat.inc by Numb */
enum Color {
NORMAL = 1,
GREEN,
TEAM_COLOR,
GREY,
RED,
BLUE,
}
new TeamName[][] = {
"",
"TERRORIST",
"CT",
"SPECTATOR"
}
/*END - From colorchat.inc by Numb */
public plugin_init() {
register_plugin("Auto Restart In X Round", ARIXR_VERSION, "He3aBuCuM")
register_logevent("roundStart", 2, "1=Round_Start")
cvar_rounds = register_cvar("amx_restart_round", "2")
cvar_time = register_cvar("amx_restart_time", "30.0")
cvar_notice = register_cvar("amx_restart_notice", "3")
cvar_message = register_cvar("amx_restart_message", "That's the %round% round!Restarting...")
cvar_message_color = register_cvar("amx_restart_message_color", "4")
cvar_hud = register_cvar("amx_restart_hud", "%seconds% seconds until restart!")
cvar_hud_color = register_cvar("amx_restart_hud_color", "0 255 0")
cvar_sound = register_cvar("amx_restart_sound", "1")
cvar_restart = get_cvar_pointer("sv_restart")
register_cvar("arixr_version", ARIXR_VERSION, FCVAR_SERVER | FCVAR_SPONLY)
hudsync = CreateHudSyncObj()
}
public roundStart() {
new rounds = get_pcvar_num(cvar_rounds)
cRound++
if(cRound == rounds) {
switch(get_pcvar_num(cvar_notice)) {
case 0: set_task(get_pcvar_float(cvar_time), "restartRound", 123457)
case 1: {
set_task(get_pcvar_float(cvar_time), "show_chat_message", 123458)
set_task(get_pcvar_float(cvar_time), "restartRound", 123457)
}
case 2: {
set_task(1.0, "hudTimer", 123456, _, _, "a", get_pcvar_num(cvar_time))
set_task(get_pcvar_float(cvar_time), "restartRound", 123457)
}
case 3: {
set_task(1.0, "hudTimer", 123456, _, _, "a", get_pcvar_num(cvar_time))
set_task(get_pcvar_float(cvar_time), "restartRound", 123457)
set_task(get_pcvar_float(cvar_time), "show_chat_message", 123458)
}
default: set_task(get_pcvar_float(cvar_time), "restartRound", 123457)
}
if(get_pcvar_num(cvar_sound))
set_task(1.0, "spkSound", 123456, _, _, "a", get_pcvar_num(cvar_time))
}
return PLUGIN_CONTINUE
}
public show_chat_message() {
if(get_playersnum(1) == 0)
return PLUGIN_HANDLED
new message[190], rounds[10]
get_pcvar_string(cvar_message, message, charsmax(message))
format(rounds, charsmax(rounds), "%d", cRound)
replace_all(message, charsmax(message), "%round%", rounds)
switch(get_pcvar_num(cvar_message_color)) {
case 1: ColorChat(0, GREEN, "[%s] %s", prefix, message)
case 2: ColorChat(0, RED, "[%s] %s", prefix, message)
case 3: ColorChat(0, GREY, "[%s] %s", prefix, message)
case 4: ColorChat(0, BLUE, "[%s] %s", prefix, message)
case 5: ColorChat(0, NORMAL, "[%s] %s", prefix, message)
case 6: ColorChat(0, TEAM_COLOR, "[%s] %s", prefix, message)
default: ColorChat(0, NORMAL, "[%s] %s", prefix, message)
}
return PLUGIN_CONTINUE
}
public hudTimer() {
if(get_playersnum(1) == 0)
return PLUGIN_HANDLED
counter++
new hud[190], rounds[10], seconds[10], red, green, blue
get_pcvar_string(cvar_hud, hud, charsmax(hud))
format(rounds, charsmax(rounds), "%d", cRound)
format(seconds, charsmax(seconds), "%d", get_pcvar_num(cvar_time) - counter)
get_hud_color(red, green, blue)
replace_all(hud, charsmax(hud), "%round%", rounds)
replace_all(hud, charsmax(hud), "%seconds%", seconds)
replace_all(hud, charsmax(hud), "/n", "^n")
set_hudmessage(red, green, blue, 0.05, 0.60, 0, 0.01, 1.0, 0.0, 0.0, -1)
ShowSyncHudMsg(0, hudsync, hud)
return PLUGIN_CONTINUE
}
public spkSound() {
if(get_playersnum(1) == 0)
return PLUGIN_HANDLED
new sound[32]
num_to_word(get_pcvar_num(cvar_time) - counter, sound, charsmax(sound))
client_cmd(0, "spk ^"vox/%s^"", sound)
return PLUGIN_CONTINUE
}
public restartRound()
set_pcvar_num(cvar_restart, 2)
get_hud_color(&r, &g, &b) {
new color[20]
static red[5], green[5], blue[5]
get_pcvar_string(cvar_hud_color, color, charsmax(color))
parse(color, red, charsmax(red), green, charsmax(green), blue, charsmax(blue))
r = str_to_num(red)
g = str_to_num(green)
b = str_to_num(blue)
}
/*START - From colorchat.inc by Numb */
ColorChat(id, Color:type, const msg[], {Float, Sql, Result,_}:...) {
new message[256]
switch(type) {
case NORMAL: message[0] = 0x01
case GREEN: message[0] = 0x04
default: message[0] = 0x03
}
vformat(message[1], 251, msg, 4)
message[192] = '^0'
new team, ColorChange, index, MSG_Type
if(id) {
MSG_Type = MSG_ONE
index = id
} else {
index = FindPlayer()
MSG_Type = MSG_ALL
}
team = get_user_team(index)
ColorChange = ColorSelection(index, MSG_Type, type)
ShowColorMessage(index, MSG_Type, message)
if(ColorChange)
Team_Info(index, MSG_Type, TeamName[team])
}
ShowColorMessage(id, type, message[]) {
static bool:saytext_used
static get_user_msgid_saytext
if(!saytext_used) {
get_user_msgid_saytext = get_user_msgid("SayText")
saytext_used = true
}
message_begin(type, get_user_msgid_saytext, _, id)
write_byte(id)
write_string(message)
message_end()
}
Team_Info(id, type, team[]) {
static bool:teaminfo_used
static get_user_msgid_teaminfo
if(!teaminfo_used) {
get_user_msgid_teaminfo = get_user_msgid("TeamInfo")
teaminfo_used = true
}
message_begin(type, get_user_msgid_teaminfo, _, id)
write_byte(id)
write_string(team)
message_end()
return 1
}
ColorSelection(index, type, Color:Type) {
switch(Type) {
case RED: return Team_Info(index, type, TeamName[1])
case BLUE: return Team_Info(index, type, TeamName[2])
case GREY: return Team_Info(index, type, TeamName[0])
}
return 0
}
FindPlayer() {
new i = -1
while(i <= get_maxplayers()) {
if(is_user_connected(++i))
return i
}
return -1
}
/*END - From colorchat.inc by Numb */